[FFmpeg-devel] [PATCH 3/4] avfilter/vf_lut3d: fix leak if allocate_3dlut failed

Lidong Yan yldhome2d2 at gmail.com
Fri Jun 27 17:09:17 EEST 2025


In parse_cinespace(), memory allocated in in_prelut[] and out_prelut[]
would leak if allocate_3dlut() failed. Replace return ret with goto end
to free memory before return error code.

Signed-off-by: Lidong Yan <502024330056 at smail.nju.edu.cn>
---
 libavfilter/vf_lut3d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c
index 5f6bfc65b3..46afe36f6c 100644
--- a/libavfilter/vf_lut3d.c
+++ b/libavfilter/vf_lut3d.c
@@ -1006,7 +1006,7 @@ static int parse_cinespace(AVFilterContext *ctx, FILE *f)
 
             ret = allocate_3dlut(ctx, size, prelut);
             if (ret < 0)
-                return ret;
+                goto end;
 
             for (int k = 0; k < size; k++) {
                 for (int j = 0; j < size; j++) {
-- 
2.50.0.108.g6ae0c543ae



More information about the ffmpeg-devel mailing list