mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
Merge commit '7d2a6826912b629f17f3b0c5268e334fa123c4c9'
* commit '7d2a6826912b629f17f3b0c5268e334fa123c4c9':
huffyuv: Check memory allocation
See: 4a722a5cab
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
73e150fff7
@ -220,8 +220,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
|||||||
ff_huffyuvencdsp_init(&s->hencdsp);
|
ff_huffyuvencdsp_init(&s->hencdsp);
|
||||||
|
|
||||||
avctx->extradata = av_mallocz(3*MAX_N + 4);
|
avctx->extradata = av_mallocz(3*MAX_N + 4);
|
||||||
if (!avctx->extradata)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
if (s->flags&CODEC_FLAG_PASS1) {
|
if (s->flags&CODEC_FLAG_PASS1) {
|
||||||
#define STATS_OUT_SIZE 21*MAX_N*3 + 4
|
#define STATS_OUT_SIZE 21*MAX_N*3 + 4
|
||||||
avctx->stats_out = av_mallocz(STATS_OUT_SIZE); // 21*256*3(%llu ) + 3(\n) + 1(0) = 16132
|
avctx->stats_out = av_mallocz(STATS_OUT_SIZE); // 21*256*3(%llu ) + 3(\n) + 1(0) = 16132
|
||||||
@ -231,7 +229,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
|||||||
s->version = 2;
|
s->version = 2;
|
||||||
|
|
||||||
avctx->coded_frame = av_frame_alloc();
|
avctx->coded_frame = av_frame_alloc();
|
||||||
if (!avctx->coded_frame)
|
if (!avctx->extradata || !avctx->coded_frame)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
|
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
|
||||||
|
Loading…
Reference in New Issue
Block a user