[libav-devel] [PATCH] asfdec: prevent the memory leak in the asf_read_metada_obj

Alexandra Hájková alexandra.khirnova at gmail.com
Thu Aug 13 10:16:20 CEST 2015


also do not return the error code but just break reading
metadata object in the case of the aspect ratio reading failure
---
 libavformat/asfdec.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 2e351ca..a452b6c 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -590,8 +590,10 @@ static int asf_read_metadata_obj(AVFormatContext *s, const GUIDParseTable *g)
                          buflen);
         if (!strcmp(name, "AspectRatioX") || !strcmp(name, "AspectRatioY")) {
             ret = asf_store_aspect_ratio(s, st_num, name, type);
-            if (ret < 0)
-                return ret;
+            if (ret < 0) {
+                av_freep(&name);
+                break;
+            }
         } else {
             if (st_num < ASF_MAX_STREAMS) {
                 if ((ret = process_metadata(s, name, name_len, val_len, type,
-- 
2.0.1



More information about the libav-devel mailing list