[PATCH] bluez5-discover: Fix device hashmap free order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



03.12.2014 16:37, David Henningsson wrote:
> In case there are still devices in the hashmap when the module is
> unloaded, we need to free the hashmap before the devices, because
> the hashmap key points to the device's name instead of making a copy.
>
> Reported-by: Alexander Patrakov <patrakov at gmail.com>
> Signed-off-by: David Henningsson <david.henningsson at canonical.com>
> ---
>
> I haven't reproduced it here, because when I run under valgrind, starting
> a stream causes PA to be killed for spending to much time in RT.
>
> Alexander, does this fix the second valgrind issue?

Yes, it does. Thanks!

>
>   src/modules/bluetooth/module-bluez5-discover.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/modules/bluetooth/module-bluez5-discover.c b/src/modules/bluetooth/module-bluez5-discover.c
> index 570cdba..57ca987 100644
> --- a/src/modules/bluetooth/module-bluez5-discover.c
> +++ b/src/modules/bluetooth/module-bluez5-discover.c
> @@ -155,11 +155,11 @@ void pa__done(pa_module *m) {
>       if (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)
>           pa_hashmap_free(u->loaded_device_paths);
>
> +    if (u->discovery)
> +        pa_bluetooth_discovery_unref(u->discovery);
> +
>       pa_xfree(u);
>   }
>

-- 
Alexander E. Patrakov


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux