Re: [PATCH 1/1] USB: core: Free the allocated memory before exiting on error

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

 



On Wed, 21 Nov 2012, Sachin Kamat wrote:

> 'new_interfaces' should be freed to avoid memory leak.
> 
> Cc: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx>
> Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Sachin Kamat <sachin.kamat@xxxxxxxxxx>
> ---
>  drivers/usb/core/message.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
> index a557658..1653f56 100644
> --- a/drivers/usb/core/message.c
> +++ b/drivers/usb/core/message.c
> @@ -1795,7 +1795,8 @@ free_interfaces:
>  	if (dev->actconfig && usb_disable_lpm(dev)) {
>  		dev_err(&dev->dev, "%s Failed to disable LPM\n.", __func__);
>  		mutex_unlock(hcd->bandwidth_mutex);
> -		return -ENOMEM;
> +		ret = -ENOMEM;
> +		goto free_interfaces;
>  	}
>  	ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL);
>  	if (ret < 0) {

Good catch, thank you.

Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux