[vlc-devel] commit: Fix a memleak in item categories. ( Rémi Duraffort )
git version control
git at videolan.org
Tue Dec 9 18:13:15 CET 2008
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Tue Dec 9 18:07:00 2008 +0100| [0d40e8b4bdeb4ed5bfcc4e12a1bc09cc39ac71d2] | committer: Rémi Duraffort
Fix a memleak in item categories.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0d40e8b4bdeb4ed5bfcc4e12a1bc09cc39ac71d2
---
src/input/item.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/input/item.c b/src/input/item.c
index 7d8d3bc..58b9e72 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -575,8 +575,7 @@ int input_item_DelInfo( input_item_t *p_i,
if( !strcmp( p_cat->pp_infos[i]->psz_name, psz_name ) )
{
free( p_cat->pp_infos[i]->psz_name );
- if( p_cat->pp_infos[i]->psz_value )
- free( p_cat->pp_infos[i]->psz_value );
+ free( p_cat->pp_infos[i]->psz_value );
free( p_cat->pp_infos[i] );
REMOVE_ELEM( p_cat->pp_infos, p_cat->i_infos, i );
break;
@@ -594,14 +593,16 @@ int input_item_DelInfo( input_item_t *p_i,
for( i = 0; i < p_cat->i_infos; i++ )
{
free( p_cat->pp_infos[i]->psz_name );
- if( p_cat->pp_infos[i]->psz_value )
- free( p_cat->pp_infos[i]->psz_value );
+ free( p_cat->pp_infos[i]->psz_value );
free( p_cat->pp_infos[i] );
}
- if( p_cat->pp_infos )
- free( p_cat->pp_infos );
+ free( p_cat->pp_infos );
REMOVE_ELEM( p_i->pp_categories, p_i->i_categories, i_cat );
}
+
+ // Free the category
+ free( p_cat->psz_name );
+ free( p_cat );
vlc_mutex_unlock( &p_i->lock );
More information about the vlc-devel
mailing list