[FFmpeg-cvslog] fftools/ffmpeg_filter: fix leak of AVIOContext in read_binary()

James Almer git at videolan.org
Fri Apr 28 19:55:54 EEST 2023


ffmpeg | branch: release/6.0 | James Almer <jamrial at gmail.com> | Fri Apr 28 13:35:19 2023 -0300| [27205c0b476a1095bc38759ad9df001e799e4843] | committer: James Almer

fftools/ffmpeg_filter: fix leak of AVIOContext in read_binary()

It was only being freed on failure.

Reviewed-by: Anton Khirnov <anton at khirnov.net>
Signed-off-by: James Almer <jamrial at gmail.com>
(cherry picked from commit 1b7c13e1a437d7db84a206e5c55b0e0aa95760ec)

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

 fftools/ffmpeg_filter.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 1f5bbf6c4d..686a33c2ba 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -352,11 +352,13 @@ static int read_binary(const char *path, uint8_t **data, int *len)
 
     *len = fsize;
 
-    return 0;
+    ret = 0;
 fail:
     avio_close(io);
-    av_freep(data);
-    *len = 0;
+    if (ret < 0) {
+        av_freep(data);
+        *len = 0;
+    }
     return ret;
 }
 



More information about the ffmpeg-cvslog mailing list