History

wma: Check memory allocation

Vittorio Giovara committed 11 years ago

Commit 83797da1 parent e1ea3651 file · +4 −0Browse files

Unified · Split

libavcodec/wmaenc.c+4−0
@@ -62,11 +62,15 @@ static av_cold int encode_init(AVCodecContext *avctx) · 61 unmodified lines
6262 flags2 = 1;
6363 if (avctx->codec->id == AV_CODEC_ID_WMAV1) {
6464 extradata = av_malloc(4);
65+ if (!extradata)
66+ return AVERROR(ENOMEM);
6567 avctx->extradata_size = 4;
6668 AV_WL16(extradata, flags1);
6769 AV_WL16(extradata + 2, flags2);
6870 } else if (avctx->codec->id == AV_CODEC_ID_WMAV2) {
6971 extradata = av_mallocz(10);
72+ if (!extradata)
73+ return AVERROR(ENOMEM);
7074 avctx->extradata_size = 10;
7175 AV_WL32(extradata, flags1);
7276 AV_WL16(extradata + 4, flags2);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t