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

James Almer git at videolan.org
Fri Apr 28 19:47:17 EEST 2023


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri Apr 28 13:35:19 2023 -0300| [1b7c13e1a437d7db84a206e5c55b0e0aa95760ec] | 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>

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

 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 b26160b375..161ea9c866 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -408,11 +408,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