[MPlayer-dev-eng] [patch] Consistent av_malloc/av_free in libmpcodecs/vd_ffmpeg.c

Lucius Windschuh lwindschuh at googlemail.com
Mon Apr 11 17:15:38 CEST 2011


Dear list members,
the current mplayer code mixes calloc() with av_free() in
libmpcodecs/vd_ffmpeg.c, resulting in assertion failures on FreeBSD
i386 with malloc debugging enabled since av_malloc modifies the
returned pointers to give alignment guarantees.
So, the wrong pointer is given to free(), making it bark.
The patch below fixes the issue by consistently using av_mallocz()
with av_free().

Index: libmpcodecs/vd_ffmpeg.c
===================================================================
--- libmpcodecs/vd_ffmpeg.c     (Revision 33081)
+++ libmpcodecs/vd_ffmpeg.c     (Arbeitskopie)
@@ -423,7 +423,7 @@
     }
     /* Pass palette to codec */
     if (sh->bih && (sh->bih->biBitCount <= 8)) {
-        avctx->palctrl = calloc(1, sizeof(AVPaletteControl));
+        avctx->palctrl = av_mallocz(sizeof(AVPaletteControl));
         avctx->palctrl->palette_changed = 1;
         if (sh->bih->biSize-sizeof(*sh->bih))
             /* Palette size in biSize */


Regards,

Lucius (not subscribed, so please Cc: me in replies)


More information about the MPlayer-dev-eng mailing list