[FFmpeg-devel] [PATCH]: git - fix bad free in dvdsub_init

Kelly Anderson kelly at silka.with-linux.com
Wed Sep 14 06:36:46 CEST 2011


Hello,

The latest git was broke sometime in the last week or so.  I didn't 
analyze which commit
broke it (since the fix was so obvious).  Here's the patch, signed off 
by me.

--- ./libavcodec/dvdsubdec.c.orig    2011-09-13 00:21:56.000000000 -0600
+++ ./libavcodec/dvdsubdec.c    2011-09-13 22:16:58.433827835 -0600
@@ -516,12 +516,12 @@ static int dvdsub_decode(AVCodecContext
  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 *a
          av_log(avctx, AV_LOG_DEBUG, "\n");
      }

-    av_free(data);
+    av_free(dataorig);
      return 1;
  }




More information about the ffmpeg-devel mailing list