]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Staging:Android:ion - Fix for memory leak if ion device registration get failed.
authorShailendra Verma <shailendra.capricorn@gmail.com>
Tue, 19 May 2015 14:59:00 +0000 (20:29 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 24 May 2015 20:27:13 +0000 (13:27 -0700)
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>
drivers/staging/android/ion/ion.c

index b0b96ab31954a98718d1af05121656abc1533e17..6f48112635571f78e0d10e50c2d3fb6f0b9277d3 100644 (file)
@@ -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);
        }