Commit 6eb79044 authored by Casian Andrei's avatar Casian Andrei Committed by Jean-Baptiste Kempf

dbus: Prevent dictionary from growing out of control

For each item that was appended or deleted, the ("Tracks", NULL) pair
was inserted (duplicated over and over) in the tracklist_properties
dictionary. The dictionary was inserting it in the same position and
it assumed it had hash collisions, triggering an expansion at every
insertion of that pair.

Check if the key is present before inserting in the dict again, at
playlist_item_append, playlist_item_deleted events.
Signed-off-by: default avatarIlkka Ollakka <ileoo@videolan.org>
(cherry picked from commit 0d3ac6a7)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 7e9873e9
...@@ -565,7 +565,8 @@ static void ProcessEvents( intf_thread_t *p_intf, ...@@ -565,7 +565,8 @@ static void ProcessEvents( intf_thread_t *p_intf,
vlc_dictionary_insert( &player_properties, "CanPlay", NULL ); vlc_dictionary_insert( &player_properties, "CanPlay", NULL );
} }
vlc_dictionary_insert( &tracklist_properties, "Tracks", NULL ); if( !vlc_dictionary_has_key( &tracklist_properties, "Tracks" ) )
vlc_dictionary_insert( &tracklist_properties, "Tracks", NULL );
break; break;
case SIGNAL_VOLUME_MUTED: case SIGNAL_VOLUME_MUTED:
case SIGNAL_VOLUME_CHANGE: case SIGNAL_VOLUME_CHANGE:
......
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