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

Clément Bœsch ubitux at gmail.com
Thu Apr 14 07:59:35 CEST 2011


On Mon, Apr 11, 2011 at 05:15:38PM +0200, Lucius Windschuh wrote:
> 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().
> 

Thank you.

> 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 */
> 
> 

Applied.

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

I missed that part in my first reply, fixed. :)

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20110414/b1bc00f4/attachment.pgp>


More information about the MPlayer-dev-eng mailing list