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
62 flags2 = 1;62 flags2 = 1;
63 if (avctx->codec->id == AV_CODEC_ID_WMAV1) {63 if (avctx->codec->id == AV_CODEC_ID_WMAV1) {
64 extradata = av_malloc(4);64 extradata = av_malloc(4);
65 if (!extradata)
66 return AVERROR(ENOMEM);
65 avctx->extradata_size = 4;67 avctx->extradata_size = 4;
66 AV_WL16(extradata, flags1);68 AV_WL16(extradata, flags1);
67 AV_WL16(extradata + 2, flags2);69 AV_WL16(extradata + 2, flags2);
68 } else if (avctx->codec->id == AV_CODEC_ID_WMAV2) {70 } else if (avctx->codec->id == AV_CODEC_ID_WMAV2) {
69 extradata = av_mallocz(10);71 extradata = av_mallocz(10);
72 if (!extradata)
73 return AVERROR(ENOMEM);
70 avctx->extradata_size = 10;74 avctx->extradata_size = 10;
71 AV_WL32(extradata, flags1);75 AV_WL32(extradata, flags1);
72 AV_WL16(extradata + 4, flags2);76 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