svn commit: r216431 - head/lib/libusb
Kevin Lo
kevlo at FreeBSD.org
Tue Dec 14 15:11:49 UTC 2010
Author: kevlo
Date: Tue Dec 14 15:11:49 2010
New Revision: 216431
URL: http://svn.freebsd.org/changeset/base/216431
Log:
Check the return value of malloc().
Reviewed by: hselasky
MFC after: 3 days
Modified:
head/lib/libusb/libusb20_compat01.c
Modified: head/lib/libusb/libusb20_compat01.c
==============================================================================
--- head/lib/libusb/libusb20_compat01.c Tue Dec 14 13:45:57 2010 (r216430)
+++ head/lib/libusb/libusb20_compat01.c Tue Dec 14 15:11:49 2010 (r216431)
@@ -457,6 +457,11 @@ usb_parse_configuration(struct usb_confi
/* allocate memory for our configuration */
ptr = malloc(a + b + c + d);
+ if (ptr == NULL) {
+ /* free config structure */
+ free(ps.a.currcfg);
+ return (-1);
+ }
/* "currifcw" must be first, hence this pointer is freed */
ps.b.currifcw = (void *)(ptr);
More information about the svn-src-all
mailing list