Commit 4d44bc5c authored by Rafaël Carré's avatar Rafaël Carré

Fix NULL dereferencing in playlist sorting - CID 141

parent 39bfc60d
...@@ -309,7 +309,6 @@ int playlist_NodeGroup( playlist_t * p_playlist , int i_view, ...@@ -309,7 +309,6 @@ int playlist_NodeGroup( playlist_t * p_playlist , int i_view,
playlist_item_t **pp_items,int i_item, playlist_item_t **pp_items,int i_item,
int i_mode, int i_type ) int i_mode, int i_type )
{ {
char *psz_search = NULL;
int i_nodes = 0; int i_nodes = 0;
playlist_item_t **pp_nodes = NULL; playlist_item_t **pp_nodes = NULL;
playlist_item_t *p_node; playlist_item_t *p_node;
...@@ -317,7 +316,8 @@ int playlist_NodeGroup( playlist_t * p_playlist , int i_view, ...@@ -317,7 +316,8 @@ int playlist_NodeGroup( playlist_t * p_playlist , int i_view,
int i,j; int i,j;
for( i = 0; i< i_item ; i++ ) for( i = 0; i< i_item ; i++ )
{ {
if( psz_search ) free( psz_search ); char *psz_search = NULL;
if( i_mode == SORT_TITLE ) if( i_mode == SORT_TITLE )
{ {
psz_search = strdup( pp_items[i]->input.psz_name ); psz_search = strdup( pp_items[i]->input.psz_name );
...@@ -338,7 +338,7 @@ int playlist_NodeGroup( playlist_t * p_playlist , int i_view, ...@@ -338,7 +338,7 @@ int playlist_NodeGroup( playlist_t * p_playlist , int i_view,
_(VLC_META_INFO_CAT), _(VLC_META_GENRE) ); _(VLC_META_INFO_CAT), _(VLC_META_GENRE) );
} }
if( psz_search && !strcmp( psz_search, "" ) ) if( !psz_search || !strcmp( psz_search, "" ) )
{ {
free( psz_search ); free( psz_search );
psz_search = strdup( _("Undefined") ); psz_search = strdup( _("Undefined") );
...@@ -363,6 +363,8 @@ int playlist_NodeGroup( playlist_t * p_playlist , int i_view, ...@@ -363,6 +363,8 @@ int playlist_NodeGroup( playlist_t * p_playlist , int i_view,
playlist_NodeAppend( p_playlist, i_view, playlist_NodeAppend( p_playlist, i_view,
pp_items[i],p_node ); pp_items[i],p_node );
} }
free( psz_search );
} }
/* Now, sort the nodes by name */ /* Now, sort the nodes by name */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment