[FFmpeg-cvslog] wma: Check memory allocation

Vittorio Giovara git at videolan.org
Mon Jun 1 02:54:42 CEST 2015


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Sun May 31 14:55:35 2015 +0200| [83797da6e36c1aadd85f41ca237dce823fc7bfa1] | committer: Luca Barbato

wma: Check memory allocation

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

 libavcodec/wmaenc.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index e801663..c176daa 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);



More information about the ffmpeg-cvslog mailing list