ChangeSet 1.925.62.3, 2003/02/07 16:42:38+11:00, baldrick@wanadoo.fr

[PATCH] USB speedtouch: Fix atmsar memory leak

Leak found by the Stanford Checker (patch by Randy Dunlap).


diff -Nru a/drivers/usb/misc/atmsar.c b/drivers/usb/misc/atmsar.c
--- a/drivers/usb/misc/atmsar.c	Tue Feb 18 16:46:03 2003
+++ b/drivers/usb/misc/atmsar.c	Tue Feb 18 16:46:03 2003
@@ -285,12 +285,12 @@
 {
 	struct atmsar_vcc_data *new;
 
+	if (!vcc)
+		return NULL;
+
 	new = kmalloc (sizeof (struct atmsar_vcc_data), GFP_KERNEL);
 
 	if (!new)
-		return NULL;
-
-	if (!vcc)
 		return NULL;
 
 	memset (new, 0, sizeof (struct atmsar_vcc_data));
