Skip to contentSkip to conversation

Staging:Android:ion - Fix for memory leak if ion device registration get failed.

PATCH New Shailendra Verma 1 participant 1 message May 19, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/staging/android/ion/ion.c |    1 +
 1 file changed, 1 insertion(+)
drivers/staging/android/ion/ion.c +1 -0
index 584a226..b7255a9 100644
@@ -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);
 	}
 
Signature · 1 line
1.7.9.5