Re: [PATCH v7 10/10] usb-dev-manager: Fix cbinfo leak in case of abnormal return

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

 



Acked-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>



On Thu, 2016-02-11 at 18:04 +0200, Dmitry Fleytman wrote:
> Signed-off-by: Dmitry Fleytman <dmitry@xxxxxxxxxx>
> ---
>  src/usb-device-manager.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
> index ef13b98..7823c54 100644
> --- a/src/usb-device-manager.c
> +++ b/src/usb-device-manager.c
> @@ -1204,23 +1204,26 @@ static void
> spice_usb_device_manager_drv_uninstall_cb(GObject *gobject,
>                                                        GAsyncResult *res,
>                                                        gpointer user_data)
>  {
> +    GError *err = NULL;
> +
>      UsbInstallCbInfo *cbinfo = user_data;
>      SpiceUsbDeviceManager *self = cbinfo->manager;
> -    GError *err = NULL;
> +    SpiceUsbDevice *device = cbinfo->device;
> +    SpiceWinUsbDriver *installer = cbinfo->installer;
> +
> +    g_free(cbinfo);
>  
>      SPICE_DEBUG("Win USB driver uninstall finished");
>      g_return_if_fail(SPICE_IS_USB_DEVICE_MANAGER(self));
>      g_return_if_fail(self->priv->use_usbclerk);
>  
> -    if (!spice_win_usb_driver_uninstall_finish(cbinfo->installer, res, &err))
> {
> +    if (!spice_win_usb_driver_uninstall_finish(installer, res, &err)) {
>          g_warning("win usb driver uninstall failed -- %s", err->message);
>          g_clear_error(&err);
>      }
>  
> -    spice_usb_device_set_state(cbinfo->device, SPICE_USB_DEVICE_STATE_NONE);
> -
> -    spice_usb_device_unref(cbinfo->device);
> -    g_free(cbinfo);
> +    spice_usb_device_set_state(device, SPICE_USB_DEVICE_STATE_NONE);
> +    spice_usb_device_unref(device);
>  }
>  
>  #endif
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]