Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2012-05-23 18:48:40 +0400
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2012-05-23 18:48:40 +0400
commit5e268633d17ccfe99955af95f5b60fc4f983a7b2 (patch)
tree51f66cca9f7c6b880b428b93d349594accd02f99 /libavcodec
parentfb6c6b15d749f63cec0d48eb374c2065ebfce936 (diff)
Do not leak extradata when encoding avui.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avuienc.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/libavcodec/avuienc.c b/libavcodec/avuienc.c
index 53688a9eec..51650739b8 100644
--- a/libavcodec/avuienc.c
+++ b/libavcodec/avuienc.c
@@ -35,6 +35,16 @@ static av_cold int avui_encode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
return AVERROR(ENOMEM);
}
+ if (!(avctx->extradata = av_mallocz(24 + FF_INPUT_BUFFER_PADDING_SIZE)))
+ return AVERROR(ENOMEM);
+ avctx->extradata_size = 24;
+ memcpy(avctx->extradata, "\0\0\0\x18""APRGAPRG0001", 16);
+ if (avctx->field_order > AV_FIELD_PROGRESSIVE) {
+ avctx->extradata[19] = 2;
+ } else {
+ avctx->extradata[19] = 1;
+ }
+
return 0;
}
@@ -56,14 +66,7 @@ static int avui_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
if ((ret = ff_alloc_packet2(avctx, pkt, size)) < 0)
return ret;
dst = pkt->data;
- if (!(avctx->extradata = av_mallocz(24 + FF_INPUT_BUFFER_PADDING_SIZE)))
- return AVERROR(ENOMEM);
- avctx->extradata_size = 24;
- memcpy(avctx->extradata, "\0\0\0\x18""APRGAPRG0001", 16);
- if (interlaced) {
- avctx->extradata[19] = 2;
- } else {
- avctx->extradata[19] = 1;
+ if (!interlaced) {
dst += avctx->width * skip;
}