[vlc-devel] vlc: svn commit r23828 (pdherbemont)

Pierre d'Herbemont pdherbemont at free.fr
Sun Dec 23 15:33:33 CET 2007


This patch is likely to introduce memleaks.

Basically the problem use to be:

p_input_item = input_ItemNew(); // refcount is 0
func_that_retain_and_release_some_time_later_the_input_item
( p_input_item );
// Some time later the input_item is released, its refcount goes back  
to 0, and...
func_that_uses_the_input_item( p_input_item );
// ... will crash.

Now,

p_input_item = input_ItemNew(); // refcount is 1
func_that_retain_and_release_some_time_later_the_input_item 
( p_input_item );
// Some time later the input_item is released, its refcount goes back  
to 1, no prob...
func_that_uses_the_input_item( p_input_item );
// ... But we have to release the p_input_item.
vlc_gc_decref( p_input_item ); // Correctly freed.

The problem is that some module are way to far from doing sane memory  
management with the input item. For instance, the xspf.c module is to  
far-fetched to be fixed rationally, and will certainly leak its input  
item. (Those module may also been those who used to crash, because of  
the pb explained before).

Pierre.

On Dec 23, 2007, at 3:19 PM, Subversion daemon wrote:

> r23828 | pdherbemont | 2007-12-23 15:19:00 +0100 (Sun, 23 Dec 2007)  
> | 6 lines
> Changed paths:
>   M /trunk/include/vlc_common.h
>   M /trunk/modules/misc/lua/vlc.c
>   M /trunk/modules/services_discovery/bonjour.c
>   M /trunk/modules/services_discovery/freebox.c
>   M /trunk/modules/services_discovery/hal.c
>   M /trunk/modules/services_discovery/sap.c
>   M /trunk/modules/services_discovery/shout.c
>
> vlc_common.h:
> * Add some proper assert() to the vlc_gc_* function to spot errors.
> * Correctly initialize the refcount to 1. (This will prevent freed  
> pointer usage). (This may also introduce leaks in some module).
> modules/*.c:
> * Prevent some module to leak input_item_t.
>
>> http://trac.videolan.org/vlc/changeset/23828
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel




More information about the vlc-devel mailing list