diff options
author | kevlo <kevlo@FreeBSD.org> | 2010-12-14 15:11:49 +0000 |
---|---|---|
committer | kevlo <kevlo@FreeBSD.org> | 2010-12-14 15:11:49 +0000 |
commit | de3f3adcdf4a94ba279b52776cdf3270a3f85ae0 (patch) | |
tree | 72ecdb8897710f32552b7300e437eb0250b40b7b /lib/libusb/libusb20_compat01.c | |
parent | fa3fef1400cdb1174735f765b87223873127bedf (diff) | |
download | FreeBSD-src-de3f3adcdf4a94ba279b52776cdf3270a3f85ae0.zip FreeBSD-src-de3f3adcdf4a94ba279b52776cdf3270a3f85ae0.tar.gz |
Check the return value of malloc().
Reviewed by: hselasky
MFC after: 3 days
Diffstat (limited to 'lib/libusb/libusb20_compat01.c')
-rw-r--r-- | lib/libusb/libusb20_compat01.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/libusb/libusb20_compat01.c b/lib/libusb/libusb20_compat01.c index aaafb02..4124ef6 100644 --- a/lib/libusb/libusb20_compat01.c +++ b/lib/libusb/libusb20_compat01.c @@ -457,6 +457,11 @@ usb_parse_configuration(struct usb_config_descriptor *config, /* 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); |