[FFmpeg-cvslog] dvdsubdec: fix bad free in dvdsub_init

Kelly Anderson git at videolan.org
Wed Sep 14 07:19:26 CEST 2011


ffmpeg | branch: master | Kelly Anderson <kelly at silka.with-linux.com> | Wed Sep 14 07:14:37 2011 +0200| [872655fee9168550cb9e12d37d7a38e56c7da0eb] | committer: Michael Niedermayer

dvdsubdec: fix bad free in dvdsub_init

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

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

 libavcodec/dvdsubdec.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 9eb5665..021d30d 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -516,12 +516,12 @@ static int dvdsub_decode(AVCodecContext *avctx,
 static int dvdsub_init(AVCodecContext *avctx)
 {
     DVDSubContext *ctx = (DVDSubContext*) avctx->priv_data;
-    char *data;
+    char *dataorig, *data;
 
     if (!avctx->extradata || !avctx->extradata_size)
         return 1;
 
-    data = av_malloc(avctx->extradata_size+1);
+    dataorig = data = av_malloc(avctx->extradata_size+1);
     if (!data)
         return AVERROR(ENOMEM);
     memcpy(data, avctx->extradata, avctx->extradata_size);
@@ -555,7 +555,7 @@ static int dvdsub_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_DEBUG, "\n");
     }
 
-    av_free(data);
+    av_free(dataorig);
     return 1;
 }
 



More information about the ffmpeg-cvslog mailing list