summaryrefslogtreecommitdiff
path: root/libavcodec/wmaenc.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-05-31 14:55:35 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-05-31 15:03:31 +0200
commit83797da6e36c1aadd85f41ca237dce823fc7bfa1 (patch)
tree001912533d7b408a8146b1bb1fe6520e0aeaa751 /libavcodec/wmaenc.c
parente1ea365f7e1477c78865b866a180712174536c20 (diff)
wma: Check memory allocation
Diffstat (limited to 'libavcodec/wmaenc.c')
-rw-r--r--libavcodec/wmaenc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index e801663d66..c176daa7c9 100644
--- a/libavcodec/wmaenc.c
+++ b/libavcodec/wmaenc.c
@@ -62,11 +62,15 @@ static av_cold int encode_init(AVCodecContext *avctx)
flags2 = 1;
if (avctx->codec->id == AV_CODEC_ID_WMAV1) {
extradata = av_malloc(4);
+ if (!extradata)
+ return AVERROR(ENOMEM);
avctx->extradata_size = 4;
AV_WL16(extradata, flags1);
AV_WL16(extradata + 2, flags2);
} else if (avctx->codec->id == AV_CODEC_ID_WMAV2) {
extradata = av_mallocz(10);
+ if (!extradata)
+ return AVERROR(ENOMEM);
avctx->extradata_size = 10;
AV_WL32(extradata, flags1);
AV_WL16(extradata + 4, flags2);