Przeglądaj źródła

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 <shailendra.capricorn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Shailendra Verma 10 lat temu
rodzic
commit
283d93041a
1 zmienionych plików z 1 dodań i 0 usunięć
  1. 1 0
      drivers/staging/android/ion/ion.c

+ 1 - 0
drivers/staging/android/ion/ion.c

@@ -1579,6 +1579,7 @@ struct ion_device *ion_device_create(long (*custom_ioctl)
 	ret = misc_register(&idev->dev);
 	ret = misc_register(&idev->dev);
 	if (ret) {
 	if (ret) {
 		pr_err("ion: failed to register misc device.\n");
 		pr_err("ion: failed to register misc device.\n");
+		kfree(idev);
 		return ERR_PTR(ret);
 		return ERR_PTR(ret);
 	}
 	}