[PATCH 961/961] staging: hv: fix memory leaks

Greg Kroah-Hartman gregkh at suse.de
Wed Mar 16 21:10:04 UTC 2011


From: Alexander Beregalov <a.beregalov at gmail.com>

Free resources before exit.

Signed-off-by: Alexander Beregalov <a.beregalov at gmail.com>
Cc: K. Y. Srinivasan <kys at microsoft.com>
Cc: Haiyang Zhang <haiyangz at microsoft.com>
Cc: Mike Sterling <mike.sterling at microsoft.com>
Cc: Abhishek Kane <v-abkane at microsoft.com>
Cc: Hank Janssen <hjanssen at microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
---
 drivers/staging/hv/hv_mouse.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index 6fa4621..50147f8 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -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;
 	}
 
-- 
1.7.4.1




More information about the devel mailing list