[PATCH 2/2] tools/gatt: Fix memory leak

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

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

Fixes following clang warning:
...
tools/btgatt-client.c:451:4: warning: Potential leak of memory pointed
to by 'value'
                        printf("Invalid value byte: %s\n", argv[i]);
                        ^~~~~~
...
---
 tools/btgatt-client.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
index ca84780..dadfa37 100644
--- a/tools/btgatt-client.c
+++ b/tools/btgatt-client.c
@@ -449,6 +449,7 @@ static void cmd_read_multiple(struct client *cli, char *cmd_str)
 		value[i] = strtol(argv[i], &endptr, 0);
 		if (endptr == argv[i] || *endptr != '\0' || !value[i]) {
 			printf("Invalid value byte: %s\n", argv[i]);
+			free(value);
 			return;
 		}
 	}
-- 
1.9.1

--
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