diff options
author | Michael Niedermayer | 2016-12-03 18:32:04 +0100 |
---|---|---|
committer | Michael Niedermayer | 2016-12-03 19:45:31 +0100 |
commit | b98510de5c2a04b45ae7471a666c36e124df4d36 (patch) | |
tree | 7f533a1a11cf56ebfc85a396a7ca8a0b0959866a | |
parent | fdf588d7cf68b5f4ff27de5b53508f0ff67c5a2e (diff) |
avformat/ffmdec: cleanup on extradata memory allocation failure
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/ffmdec.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index c5917a1246..1bd380b6a8 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); } |