asfdec: prevent the memory leak in the asf_read_metada_obj
authorAlexandra Hájková <alexandra.khirnova@gmail.com>
Thu, 13 Aug 2015 08:16:20 +0000 (10:16 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Sun, 16 Aug 2015 18:00:37 +0000 (20:00 +0200)
also do not return the error code but just break reading
metadata object in the case of the aspect ratio reading failure

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
libavformat/asfdec.c

index 93e8c3c..4b04227 100644 (file)
@@ -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,