summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaurav <g.gupta@samsung.com>2015-05-13 13:51:46 +0530
committerChris Dickens <christopher.a.dickens@gmail.com>2015-05-13 20:26:57 -0700
commitc8662f893e009167f48c90a8772a07ba36f28d15 (patch)
treeef40e32e9ded0508219e4bb316e55d1e2a90c203
parent9b2c8abf134b96b6c1798615e0ed17991b8c0692 (diff)
downloadlibusb-c8662f893e009167f48c90a8772a07ba36f28d15.tar.gz
Windows: Check for "calloc" allocation failure.
It need to check return value of calloc. It may fail & return Null. Closes #67 Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
-rw-r--r--libusb/os/windows_usb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
index e6a0483..ccff8a1 100644
--- a/libusb/os/windows_usb.c
+++ b/libusb/os/windows_usb.c
@@ -1661,6 +1661,10 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered
LOOP_BREAK(LIBUSB_ERROR_OVERFLOW);
}
if_guid = (GUID*) calloc(1, sizeof(GUID));
+ if (if_guid == NULL) {
+ usbi_err(ctx, "could not calloc for if_guid: not enough memory");
+ LOOP_BREAK(LIBUSB_ERROR_NO_MEM);
+ }
pCLSIDFromString(guid_string_w, if_guid);
guid[nb_guids++] = if_guid;
usbi_dbg("extra GUID: %s", guid_to_string(if_guid));