Re: [patch]fix memory leak in usbtmc's get_capabilities()

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

 



On Thu, 2 Jul 2009 11:20:12 +0200, Oliver Neukum wrote:

> @@ -763,7 +763,7 @@ static int get_capabilities(struct usbtmc_device_data *data)
>  			     0, 0, buffer, 0x18, USBTMC_TIMEOUT);
>  	if (rv < 0) {
>  		dev_err(dev, "usb_control_msg returned %d\n", rv);
> -		return rv;
> +		goto err_out;
>  	}
>  
>  	dev_dbg(dev, "GET_CAPABILITIES returned %x\n", buffer[0]);
> @@ -773,7 +773,8 @@ static int get_capabilities(struct usbtmc_device_data *data)
>  	dev_dbg(dev, "USB488 device capabilities are %x\n", buffer[15]);
>  	if (buffer[0] != USBTMC_STATUS_SUCCESS) {
>  		dev_err(dev, "GET_CAPABILITIES returned %x\n", buffer[0]);
> -		return -EPERM;
> +		rv = -EPERM;
> +		goto err_out;
>  	}
>  
>  	data->capabilities.interface_capabilities = buffer[4];
> @@ -781,6 +782,7 @@ static int get_capabilities(struct usbtmc_device_data *data)
>  	data->capabilities.usb488_interface_capabilities = buffer[14];
>  	data->capabilities.usb488_device_capabilities = buffer[15];
>  
> +err_out:
>  	kfree(buffer);
>  	return 0;

Shouldn't that be changed to "return rv;" here then?

-- 
Tilman Schmidt                    E-Mail: tilman@xxxxxxx
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)

Attachment: signature.asc
Description: OpenPGP digital signature


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

  Powered by Linux