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

Ramiro Polla angustia
Mon Aug 21 02:11:54 CEST 2006

Michael Niedermayer wrote:
>>> 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
New patch attached. Is the info text good?

>> 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, 
> no

May I receive a better explanation given the scenario I described? Or a 
pointer to a previous discussion on the issue.
I know it's not a problem on linux systems, but it is an issue on 
systems that use the memalign hack, since the wrong pointer is passed to 
the system's free function.

Ramiro Polla
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: output_example_av_malloc_2.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060820/d5b0c38e/attachment.txt>

More information about the ffmpeg-devel mailing list