From: Juho Hämäläinen Date: Tue, 15 Apr 2014 13:11:48 +0000 (+0300) Subject: dbus: Use correct initialization for source ports hashmap. X-Git-Url: https://code.delx.au/pulseaudio/commitdiff_plain/a306d66525a996a5095ff144b7b03403d2666cb5?hp=7fac10730128141fb47b6ecbe3a0cfa7f367ab3a dbus: Use correct initialization for source ports hashmap. Source ports hashmap is created without value freeing function, which results in (hashmap values) device ports not being freed when source ports are removed or module is unloaded. This results in memory leak during normal operation and during daemon shutdown dbus_protocol shared object isn't unreferenced correctly, leaving dbus_protocol object in core->shared, which causes assert when shared hashmap is checked for isempty() before freeing. --- diff --git a/src/modules/dbus/iface-device.c b/src/modules/dbus/iface-device.c index 34b370b5..625f057a 100644 --- a/src/modules/dbus/iface-device.c +++ b/src/modules/dbus/iface-device.c @@ -1248,7 +1248,7 @@ pa_dbusiface_device *pa_dbusiface_device_new_source(pa_dbusiface_core *core, pa_ d->volume = *pa_source_get_volume(source, false); d->mute = pa_source_get_mute(source, false); d->source_state = pa_source_get_state(source); - d->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); + d->ports = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, (pa_free_cb_t) pa_dbusiface_device_port_free); d->next_port_index = 0; d->active_port = source->active_port; d->proplist = pa_proplist_copy(source->proplist);