[Ffmpeg-devel] [PATCH] plain malloc in output_example.c

Michael Niedermayer michaelni
Mon Aug 21 00:39:01 CEST 2006


On Sun, Aug 20, 2006 at 03:51:24PM -0300, Ramiro Polla wrote:
> Hello,
> Michael Niedermayer wrote:
> >>Unless I really missed something, the patch fixes all occurences of
> >>malloc() in output_example.c. The executable file doesn't ever call the
> >>system's malloc directly anymore.
> >>Am I missing something?
> >>    
> >
> >nope, sorry ...
> >the original patch is ok if you add some note which says that the
> >buffers passed into lav* can be allocated any way the user likes
> >as long as they are aligned by enough for the architecture
> >  
> In output_example.c, we have some calls to av_free in which the memory 
> has been allocated internally by lav*, such as 
> av_free(picture->data[0]); in line 400. So that memory has been 
> allocated by av_malloc() (possibly with the memalign hack), and must 
> therefore be freed by av_free().
> Also, av_freep is used, which internally uses av_free. So that buffer 
> must also have been allocated with av_malloc() to be correctly 
> deallocated by av_free().
> Wouldn't it be best to suggest that all memory fed to lav* in a program 
> be allocated and freed by the av_{malloc,free}() functions? Otherwise, 


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is

More information about the ffmpeg-devel mailing list