It was only being freed on failure.

Signed-off-by: James Almer <jamr...@gmail.com>
---
 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;
 }
 
-- 
2.40.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to