patch-2.3.39 linux/drivers/usb/scanner.c
Next file: linux/drivers/usb/usb-core.c
Previous file: linux/drivers/usb/proc_usb.c
Back to the patch index
Back to the overall index
-  Lines: 16
-  Date:
Mon Jan 10 16:05:19 2000
-  Orig file: 
v2.3.38/linux/drivers/usb/scanner.c
-  Orig date: 
Fri Jan  7 19:13:22 2000
diff -u --recursive --new-file v2.3.38/linux/drivers/usb/scanner.c linux/drivers/usb/scanner.c
@@ -410,9 +410,12 @@
 		hps->oep = endpoint[1].bEndpointAddress;
 	}
 
-	ident = usb_string(dev, dev->descriptor.iProduct); /* usb_string allocates memory using kmalloc() so kfree() needs to be called afterwards when the pointer is no longer needed. */
-	info("USB Scanner (%s) found at address %d", ident, dev->devnum);
-	kfree(ident);
+	ident = kmalloc(256, GFP_KERNEL);
+	if (ident) {
+		usb_string(dev, dev->descriptor.iProduct, ident, 256);
+		info("USB Scanner (%s) found at address %d", ident, dev->devnum);
+		kfree(ident);
+	}
 
 	dbg("probe_scanner: using bulk endpoints - In: %x  Out: %x", hps->iep, hps->oep);
 
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)