diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-04-03 23:44:38 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-04-04 00:02:14 +0200 |
commit | 4d02dfbde475d249916eb19c360e890059aa6aa5 (patch) | |
tree | e9c9977480deded79b39b824a4b2e3606d5094a1 | |
parent | 20ba28af945aa9bac822ce3f2d9797405fcb5d44 (diff) | |
download | ffmpeg-4d02dfbde475d249916eb19c360e890059aa6aa5.tar.gz |
ffmpeg: Fix extradata allocation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | ffmpeg.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -2684,11 +2684,13 @@ static int transcode_init(void) enc_ctx->rc_max_rate = dec_ctx->rc_max_rate; enc_ctx->rc_buffer_size = dec_ctx->rc_buffer_size; enc_ctx->field_order = dec_ctx->field_order; - enc_ctx->extradata = av_mallocz(extra_size); - if (!enc_ctx->extradata) { - return AVERROR(ENOMEM); + if (dec_ctx->extradata_size) { + enc_ctx->extradata = av_mallocz(extra_size); + if (!enc_ctx->extradata) { + return AVERROR(ENOMEM); + } + memcpy(enc_ctx->extradata, dec_ctx->extradata, dec_ctx->extradata_size); } - memcpy(enc_ctx->extradata, dec_ctx->extradata, dec_ctx->extradata_size); enc_ctx->extradata_size= dec_ctx->extradata_size; enc_ctx->bits_per_coded_sample = dec_ctx->bits_per_coded_sample; |