From: Shailendra Verma Date: Tue, 19 May 2015 14:59:00 +0000 (+0530) Subject: Staging:Android:ion - Fix for memory leak if ion device registration get failed. X-Git-Tag: v4.14-rc1~5163^2~623 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=283d93041a424a6152626940f4bc0deb78faacae;p=platform%2Fkernel%2Flinux-rpi.git Staging:Android:ion - Fix for memory leak if ion device registration get failed. 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index b0b96ab..6f48112 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -1579,6 +1579,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); }