[FFmpeg-cvslog] lavc: fix 10l oversight in realloc of avcodec_encode_video2.

Michael Niedermayer git at videolan.org
Wed Feb 29 21:51:27 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Feb 29 21:33:00 2012 +0100| [a77c8ade2ee20fc6149e4c689a3f196f53e85273] | committer: Michael Niedermayer

lavc: fix 10l oversight in realloc of avcodec_encode_video2.

Packets are not guranteed to be allocated by av_malloc().

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a77c8ade2ee20fc6149e4c689a3f196f53e85273
---

 libavcodec/utils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 99e36f8..b612ca1 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1219,7 +1219,7 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
             avpkt->size = 0;
         else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY))
             avpkt->pts = avpkt->dts = frame->pts;
-        if (avpkt->data) {
+        if (avpkt->data && avpkt->destruct == av_destruct_packet) {
             new_data = av_realloc(avpkt->data,
                                   avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
             if (new_data)



More information about the ffmpeg-cvslog mailing list