avformat/ffmdec: cleanup on extradata memory allocation failure
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 3 Dec 2016 17:32:04 +0000 (18:32 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 3 Dec 2016 18:45:31 +0000 (19:45 +0100)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/ffmdec.c

index c5917a1..1bd380b 100644 (file)
@@ -379,8 +379,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
                     goto fail;
                 }
                 codecpar->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
-                if (!codecpar->extradata)
-                    return AVERROR(ENOMEM);
+                if (!codecpar->extradata) {
+                    ret = AVERROR(ENOMEM);
+                    goto fail;
+                }
                 codecpar->extradata_size = size;
                 avio_read(pb, codecpar->extradata, size);
             }
@@ -690,8 +692,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
                 goto fail;
             }
             codecpar->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
-            if (!codecpar->extradata)
-                return AVERROR(ENOMEM);
+            if (!codecpar->extradata) {
+                ret = AVERROR(ENOMEM);
+                goto fail;
+            }
             codecpar->extradata_size = size;
             avio_read(pb, codecpar->extradata, size);
         }