mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/libxvid: check for av_malloc*() failures
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
bd12aa2bc5
commit
5c95de150f
@ -287,6 +287,8 @@ static int xvid_strip_vol_header(AVCodecContext *avctx, AVPacket *pkt,
|
||||
/* We need to store the header, so extract it */
|
||||
if (!avctx->extradata) {
|
||||
avctx->extradata = av_malloc(vo_len);
|
||||
if (!avctx->extradata)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(avctx->extradata, pkt->data, vo_len);
|
||||
avctx->extradata_size = vo_len;
|
||||
}
|
||||
@ -625,11 +627,19 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)
|
||||
if (avctx->intra_matrix) {
|
||||
intra = avctx->intra_matrix;
|
||||
x->intra_matrix = av_malloc(sizeof(unsigned char) * 64);
|
||||
if (!x->intra_matrix) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
} else
|
||||
intra = NULL;
|
||||
if (avctx->inter_matrix) {
|
||||
inter = avctx->inter_matrix;
|
||||
x->inter_matrix = av_malloc(sizeof(unsigned char) * 64);
|
||||
if (!x->inter_matrix) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
} else
|
||||
inter = NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user