USB: core: Free the allocated memory before exiting on error
authorSachin Kamat <sachin.kamat@linaro.org>
Wed, 21 Nov 2012 05:31:19 +0000 (11:01 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Nov 2012 21:32:26 +0000 (13:32 -0800)
'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>
drivers/usb/core/message.c

index 73c5d1a..131f736 100644 (file)
@@ -1786,7 +1786,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) {