[FFmpeg-cvslog] avfilter/vf_lut3d: fix leak if allocate_3dlut failed

Lidong Yan git at videolan.org
Sun Jun 29 01:36:32 EEST 2025


ffmpeg | branch: master | Lidong Yan <yldhome2d2 at gmail.com> | Fri Jun 27 22:09:17 2025 +0800| [a17596f55bcaac57c7670c053b28599bc6d1c347] | committer: Michael Niedermayer

avfilter/vf_lut3d: fix leak if allocate_3dlut failed

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>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a17596f55bcaac57c7670c053b28599bc6d1c347
---

 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++) {



More information about the ffmpeg-cvslog mailing list