Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933490AbbESO7R (ORCPT ); Tue, 19 May 2015 10:59:17 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:34630 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932753AbbESO7P (ORCPT ); Tue, 19 May 2015 10:59:15 -0400 From: Shailendra Verma To: Greg Kroah-Hartman , =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Riley Andrews , Sumit Semwal , Mitchel Humpherys , Phong Tran , Mauro Carvalho Chehab , Rasmus Villemoes , Markus Elfring , devel@driverdev.osuosl.org Cc: linux-kernel@vger.kernel.org, Shailendra Verma Subject: [PATCH] Staging:Android:ion - Fix for memory leak if ion device registration get failed. Date: Tue, 19 May 2015 20:29:00 +0530 Message-Id: <1432047540-3436-1-git-send-email-shailendra.capricorn@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1005 Lines: 29 Fix to avoid possible memory leak if the ion device registration get failed.Free the allocated device creation memory before return in case the ion device registration get failed. Signed-off-by: Shailendra Verma --- drivers/staging/android/ion/ion.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 584a226..b7255a9 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -1577,6 +1577,7 @@ struct ion_device *ion_device_create(long (*custom_ioctl) ret = misc_register(&idev->dev); if (ret) { pr_err("ion: failed to register misc device.\n"); + kfree(idev); return ERR_PTR(ret); } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/