mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
Plug some memory leaks and an invalid read
Note in protocol-dbus.c specifically, method_signatures needs to be freed before method_handlers, because otherwise h->method_name is freed while it is still in use as a key in the method_signatures hashmap.
This commit is contained in:
parent
a8f20e8d95
commit
b430407f47
5 changed files with 6 additions and 3 deletions
|
|
@ -569,6 +569,8 @@ int pa__init(pa_module *m) {
|
||||||
u->dbus_protocol = pa_dbus_protocol_get(m->core);
|
u->dbus_protocol = pa_dbus_protocol_get(m->core);
|
||||||
u->core_iface = pa_dbusiface_core_new(m->core);
|
u->core_iface = pa_dbusiface_core_new(m->core);
|
||||||
|
|
||||||
|
pa_modargs_free(ma);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|
|
||||||
|
|
@ -246,14 +246,13 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3
|
||||||
t != (PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE))
|
t != (PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
entry = entry_new();
|
|
||||||
|
|
||||||
if (!(card = pa_idxset_get_by_index(c->cards, idx)))
|
if (!(card = pa_idxset_get_by_index(c->cards, idx)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!card->save_profile)
|
if (!card->save_profile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
entry = entry_new();
|
||||||
entry->profile = pa_xstrdup(card->active_profile ? card->active_profile->name : "");
|
entry->profile = pa_xstrdup(card->active_profile ? card->active_profile->name : "");
|
||||||
|
|
||||||
if ((old = entry_read(u, card->name))) {
|
if ((old = entry_read(u, card->name))) {
|
||||||
|
|
|
||||||
|
|
@ -328,6 +328,7 @@ static void dbus_entry_free(struct dbus_entry *de) {
|
||||||
|
|
||||||
pa_xfree(de->entry_name);
|
pa_xfree(de->entry_name);
|
||||||
pa_xfree(de->object_path);
|
pa_xfree(de->object_path);
|
||||||
|
pa_xfree(de);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reads an array [(UInt32, UInt32)] from the iterator. The struct items are
|
/* Reads an array [(UInt32, UInt32)] from the iterator. The struct items are
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,7 @@ void pa_flist_free(pa_flist *l, pa_free_cb_t free_cb) {
|
||||||
free_cb(pa_atomic_ptr_load(&elem->ptr));
|
free_cb(pa_atomic_ptr_load(&elem->ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pa_xfree((char *) l->name);
|
||||||
pa_xfree(l);
|
pa_xfree(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -839,8 +839,8 @@ int pa_dbus_protocol_remove_interface(pa_dbus_protocol *p, const char* path, con
|
||||||
pa_log_debug("Interface %s removed from object %s", iface_entry->name, obj_entry->path);
|
pa_log_debug("Interface %s removed from object %s", iface_entry->name, obj_entry->path);
|
||||||
|
|
||||||
pa_xfree(iface_entry->name);
|
pa_xfree(iface_entry->name);
|
||||||
pa_hashmap_free(iface_entry->method_handlers, method_handler_free_cb, NULL);
|
|
||||||
pa_hashmap_free(iface_entry->method_signatures, method_signature_free_cb, NULL);
|
pa_hashmap_free(iface_entry->method_signatures, method_signature_free_cb, NULL);
|
||||||
|
pa_hashmap_free(iface_entry->method_handlers, method_handler_free_cb, NULL);
|
||||||
pa_hashmap_free(iface_entry->property_handlers, property_handler_free_cb, NULL);
|
pa_hashmap_free(iface_entry->property_handlers, property_handler_free_cb, NULL);
|
||||||
|
|
||||||
for (i = 0; i < iface_entry->n_signals; ++i) {
|
for (i = 0; i < iface_entry->n_signals; ++i) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue