[MPlayer-dev-eng] [PATCH] memalign hack should use av_malloc

Rich Felker dalias at aerifal.cx
Sun Jul 23 19:14:53 CEST 2006


On Sun, Jul 23, 2006 at 01:39:47PM +0200, Hervé W. wrote:
> On 23/07/06, Gianluigi Tiesi wrote:
> >On Sun, Jul 23, 2006 at 02:43:56AM +0200, Hervé W. wrote:
> [...]
> >> If memalign gets defined as av_malloc, doesn't free have to become
> >> av_free (or av_freep) ? I think I saw some lines in liba52/parse.c and
> >> in libswscale/swscale.c where "memaligned" memory gets free'd and I
> >> think there are more locations.
> >> And if free becomes av_free, all the rest of the real malloc, calloc
> >> and realloc call should become av_*alloc. It has the added benifit
> >> that enabling SSE in MinGW builds shouldn't cause any problems
> >> anymore.
> >>
> >I'm making sse enabled mingw builds and I had no negative
> >feedbacks about, I'll ask to add mingw to supported sse arch
> >if I will not get negative responses from users.
> 
> Fine. No problem. That wasn't the main thing I was trying to say, though.
> 
> av_malloc, with MEMALIGN_HACK defined, returns ptr2 for memory like:
>  __________________________
> |              |       |                       |
> |              | diff  |   data              |
> |________|____|_____________|
> |                      |
> ptr1                 ptr2
> 
> and some "memaligned" memory gets free'd (not av_free'd or
> av_freep'd). Would calling free on anything but ptr1 work? and if it

Absolutely not. But calling av_free on ptr2 does work.

Rich




More information about the MPlayer-dev-eng mailing list