Skip to content

Commit

Permalink
USB: core: Free the allocated memory before exiting on error
Browse files Browse the repository at this point in the history
'new_interfaces' should be freed to avoid memory leak.

Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Sachin Kamat authored and Greg Kroah-Hartman committed Nov 21, 2012
1 parent 564e698 commit c058f7a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/usb/core/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -1786,7 +1786,8 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
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) {
Expand Down

0 comments on commit c058f7a

Please sign in to comment.