[FFmpeg-devel] [PATCH 2/2] avformat/oggparsevorbis: free base64 encoded data immediately after decoding it

James Almer jamrial at gmail.com
Fri Jun 17 00:30:41 CEST 2016


It has no use afterwards and freeing it before calling ff_flac_parse_picture()
may help prevent OOM issues on memory constrained scenarios.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavformat/oggparsevorbis.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index c168718..89f40f6 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -161,10 +161,11 @@ int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m,
                     av_freep(&ct);
                     continue;
                 }
-                if ((ret = av_base64_decode(pict, ct, len)) > 0)
-                    ret = ff_flac_parse_picture(as, pict, ret);
+                ret = av_base64_decode(pict, ct, len);
                 av_freep(&tt);
                 av_freep(&ct);
+                if (ret > 0)
+                    ret = ff_flac_parse_picture(as, pict, ret);
                 av_freep(&pict);
                 if (ret < 0) {
                     av_log(as, AV_LOG_WARNING, "Failed to parse cover art block.\n");
-- 
2.8.2



More information about the ffmpeg-devel mailing list