PERFORCE change 165267 for review

Sylvestre Gallon syl at FreeBSD.org
Fri Jun 26 18:26:51 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=165267

Change 165267 by syl at syl_atuin on 2009/06/26 18:26:27

	Remove a memory leak. Spotted by Hans Petter Selasky.

Affected files ...

.. //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10.c#46 edit

Differences ...

==== //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10.c#46 (text+ko) ====

@@ -177,6 +177,11 @@
 		ddesc = libusb20_dev_get_device_desc(pdev);
 		dev = malloc(sizeof(*dev));
 		if (dev == NULL) {
+			while (i != 0) {
+				libusb_unref_device((*list)[i - 1]);
+				free((*list)[i - 1]);
+				i--;
+			}
 			free(*list);
 			libusb20_be_free(usb_backend);
 			return (LIBUSB_ERROR_NO_MEM);


More information about the p4-projects mailing list