From patchwork Wed Nov 21 05:31:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13023 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 1737223E08 for ; Wed, 21 Nov 2012 05:37:35 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id B8221A19BB2 for ; Wed, 21 Nov 2012 05:37:34 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so2262820iag.11 for ; Tue, 20 Nov 2012 21:37:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=kX1Skig5zfLydKtBZMjR7Kw0MMg6VQwAnjp2X4yrELc=; b=exP+432Das6eezwTLa5KCCk4EizJ8R1D7zt30kbsZWj1h8+7DMRa8DBNJF2m/hUXQd o8PhxTBox5VMWj9sEyIYtGjJMUdUewjoMfsvPcgq0/XruNYiviXeV/hY2MaWW+0QHT1G yJvrSNO3P7NEMyVOwIzeQklWSJnLxlWqhng147igObKrzC8z9aIOSzY5j6MYTpO28uKG 0ek+Gb0qU5bfc4zdUfO/UC3jhGPJVbxVm2GVVzYLCIEFuI08g42Yi6GCvP9/h/bxBycr sosRrr+74eGb5jVUNXUOnbuCWq8kKaatIFMMk1bCNy/+03+UW5cMmNOl+D/strxavBUj gM3g== Received: by 10.50.152.137 with SMTP id uy9mr12365251igb.62.1353476254050; Tue, 20 Nov 2012 21:37:34 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp435896igt; Tue, 20 Nov 2012 21:37:33 -0800 (PST) Received: by 10.66.87.163 with SMTP id az3mr14757406pab.62.1353476252940; Tue, 20 Nov 2012 21:37:32 -0800 (PST) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by mx.google.com with ESMTPS id ic4si20086813pbc.139.2012.11.20.21.37.32 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 20 Nov 2012 21:37:32 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.42 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.220.42; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.42 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by mail-pa0-f42.google.com with SMTP id rl6so1072370pac.1 for ; Tue, 20 Nov 2012 21:37:32 -0800 (PST) Received: by 10.66.82.73 with SMTP id g9mr12209719pay.5.1353476252669; Tue, 20 Nov 2012 21:37:32 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id j10sm9340250pax.8.2012.11.20.21.37.28 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 20 Nov 2012 21:37:31 -0800 (PST) From: Sachin Kamat To: linux-usb@vger.kernel.org Cc: gregkh@linuxfoundation.org, sachin.kamat@linaro.org, patches@linaro.org, Sarah Sharp , Alan Stern Subject: [PATCH 1/1] USB: core: Free the allocated memory before exiting on error Date: Wed, 21 Nov 2012 11:01:19 +0530 Message-Id: <1353475879-30450-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQnlGPHVkDqZY/V0beFu9hrBeKtt9HPOyecNgvGc9rGiyK66nyShS/REMdvJ7hmvEEymaicd 'new_interfaces' should be freed to avoid memory leak. Cc: Sarah Sharp Cc: Alan Stern Signed-off-by: Sachin Kamat Acked-by: Alan Stern --- 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) {