staging: hv: fix memory leaks
authorAlexander Beregalov <a.beregalov@gmail.com>
Sun, 13 Mar 2011 18:58:49 +0000 (21:58 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 14 Mar 2011 19:38:15 +0000 (12:38 -0700)
Free resources before exit.

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Mike Sterling <mike.sterling@microsoft.com>
Cc: Abhishek Kane <v-abkane@microsoft.com>
Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/hv/hv_mouse.c

index 6fa462109ce973eea48968ba5c9b741c91160fc5..50147f84741cbef6f23a3828711a2c2a8116a073 100644 (file)
@@ -684,6 +684,7 @@ static int MousevscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)
 
        if (ret != 0) {
                pr_err("unable to open channel: %d", ret);
+               FreeInputDevice(inputDevice);
                return -1;
        }
 
@@ -695,6 +696,7 @@ static int MousevscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)
                pr_err("unable to connect channel: %d", ret);
 
                vmbus_close(Device->channel);
+               FreeInputDevice(inputDevice);
                return ret;
        }