aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer2016-12-03 18:32:04 +0100
committerMichael Niedermayer2016-12-03 19:45:31 +0100
commitb98510de5c2a04b45ae7471a666c36e124df4d36 (patch)
tree7f533a1a11cf56ebfc85a396a7ca8a0b0959866a
parentfdf588d7cf68b5f4ff27de5b53508f0ff67c5a2e (diff)
avformat/ffmdec: cleanup on extradata memory allocation failure
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/ffmdec.c12
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);
}