module-bluez5-discover: avoid use after free on de-init

Hashmap loaded_device_paths contain objects holding keys to entries, and
these objects must be alive while map is emptied.

Reorder freeing this hashmap before destroying device objects to fix
crash on exit.
This commit is contained in:
Igor V. Kovalenko 2020-10-15 23:55:17 +03:00 committed by Arun Raghavan
parent ef6ceb83a2
commit 3fc2ac10c6

View file

@ -163,11 +163,11 @@ void pa__done(pa_module *m) {
if (u->device_connection_changed_slot) if (u->device_connection_changed_slot)
pa_hook_slot_free(u->device_connection_changed_slot); pa_hook_slot_free(u->device_connection_changed_slot);
if (u->discovery)
pa_bluetooth_discovery_unref(u->discovery);
if (u->loaded_device_paths) if (u->loaded_device_paths)
pa_hashmap_free(u->loaded_device_paths); pa_hashmap_free(u->loaded_device_paths);
if (u->discovery)
pa_bluetooth_discovery_unref(u->discovery);
pa_xfree(u); pa_xfree(u);
} }