[PATCH 2/2] tools/gatt: Fix not checking malloc() failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

This follows standard practice elsewhere in this file.
---
 tools/btgatt-client.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
index e2e0537..62c4d3e 100644
--- a/tools/btgatt-client.c
+++ b/tools/btgatt-client.c
@@ -457,6 +457,10 @@ static void cmd_read_multiple(struct client *cli, char *cmd_str)
 	}
 
 	value = malloc(sizeof(uint16_t) * argc);
+	if (!value) {
+		printf("Failed to construct value\n");
+		return;
+	}
 
 	for (i = 0; i < argc; i++) {
 		value[i] = strtol(argv[i], &endptr, 0);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux