aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2023-04-28 13:35:19 -0300
committerJames Almer <jamrial@gmail.com>2023-04-28 13:54:57 -0300
commit27205c0b476a1095bc38759ad9df001e799e4843 (patch)
tree154863d241422da0bbf18f73f8e2cba8f5a64f8e
parent8f61cbf1b9249a732b40fc26fc4f84e390f6e2d4 (diff)
downloadffmpeg-27205c0b476a1095bc38759ad9df001e799e4843.tar.gz
fftools/ffmpeg_filter: fix leak of AVIOContext in read_binary()
It was only being freed on failure. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com> (cherry picked from commit 1b7c13e1a437d7db84a206e5c55b0e0aa95760ec)
-rw-r--r--fftools/ffmpeg_filter.c8
1 files 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;
}