[FFmpeg-cvslog] ffmpeg: Fix extradata allocation
Michael Niedermayer
git at videolan.org
Sat Apr 11 22:12:28 CEST 2015
ffmpeg | branch: release/2.6 | Michael Niedermayer <michaelni at gmx.at> | Fri Apr 3 23:44:38 2015 +0200| [9bff35abde6737686ba150c9b8a65d2883123153] | committer: Michael Niedermayer
ffmpeg: Fix extradata allocation
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 4d02dfbde475d249916eb19c360e890059aa6aa5)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9bff35abde6737686ba150c9b8a65d2883123153
---
ffmpeg.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/ffmpeg.c b/ffmpeg.c
index 6604ff0..e4fbf2a 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2666,11 +2666,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;
More information about the ffmpeg-cvslog
mailing list