[FFmpeg-devel] [PATCH] tools/scale_slice_test: Add av_frame_free() to avoid potential memory leaks

Jiasheng Jiang jiashengjiangcool at gmail.com
Sat Aug 9 06:10:20 EEST 2025


Add av_frame_free() to release frame to avoid potential memory leaks.

Fixes: 5fdb5ed613 ("FATE: add a test for sliced scaling")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool at gmail.com>
---
 tools/scale_slice_test.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/scale_slice_test.c b/tools/scale_slice_test.c
index 4480bf8569..a6b888090f 100644
--- a/tools/scale_slice_test.c
+++ b/tools/scale_slice_test.c
@@ -157,6 +157,7 @@ int main(int argc, char **argv)
 
         ret = av_frame_get_buffer(frame, 0);
         if (ret < 0) {
+            av_frame_free(&frame);
             fprintf(stderr, "Error allocating frame data\n");
             return ret;
         }
@@ -173,6 +174,7 @@ int main(int argc, char **argv)
 
     ret = ds_open(&dc, filename, 0);
     if (ret < 0) {
+        av_frame_free(&frame);
         fprintf(stderr, "Error opening the file\n");
         return ret;
     }
-- 
2.25.1



More information about the ffmpeg-devel mailing list