[vlc-commits] dbus: Prevent dictionary from growing out of control

Casian Andrei git at videolan.org
Mon Mar 5 19:21:18 CET 2012


vlc/vlc-2.0 | branch: master | Casian Andrei <skeletk13 at gmail.com> | Wed Feb 22 10:29:02 2012 +0200| [6eb79044e71d039829b482c7313af9f78db77bd5] | committer: 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: Ilkka Ollakka <ileoo at videolan.org>
(cherry picked from commit 0d3ac6a7df7e205bdaff6e1493abdf1a62fa45b8)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=6eb79044e71d039829b482c7313af9f78db77bd5
---

 modules/control/dbus/dbus.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c
index 57df944..d0c5741 100644
--- a/modules/control/dbus/dbus.c
+++ b/modules/control/dbus/dbus.c
@@ -565,7 +565,8 @@ static void ProcessEvents( intf_thread_t *p_intf,
                 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;
         case SIGNAL_VOLUME_MUTED:
         case SIGNAL_VOLUME_CHANGE:



More information about the vlc-commits mailing list