[FFmpeg-cvslog] avformat/ffmdec: cleanup on extradata memory allocation failure

Michael Niedermayer git at videolan.org
Sat Dec 3 20:47:44 EET 2016


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Dec  3 18:32:04 2016 +0100| [b98510de5c2a04b45ae7471a666c36e124df4d36] | committer: Michael Niedermayer

avformat/ffmdec: cleanup on extradata memory allocation failure

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b98510de5c2a04b45ae7471a666c36e124df4d36
---

 libavformat/ffmdec.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index c5917a1..1bd380b 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -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);
         }



More information about the ffmpeg-cvslog mailing list