[PATCH 3/3 v2] Fix uninitialized variables warnings

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

 



From: Luiz Augusto von Dentz <luiz.dentz-von@xxxxxxxxx>

src/attrib-server.c: In function âchannel_handlerâ:
src/attrib-server.c:297:21: error: âcurâ may be used uninitialized in this function
src/attrib-server.c:502:10: error: âformatâ may be used uninitialized in this function
src/attrib-server.c:503:11: error: âlengthâ may be used uninitialized in this function
make[1]: *** [src/attrib-server.o] Error 1
---
 src/attrib-server.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/attrib-server.c b/src/attrib-server.c
index dc05d7e..98bd6b1 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -315,7 +315,7 @@ static uint16_t read_by_group(struct gatt_channel *channel, uint16_t start,
 					ATT_ECODE_UNSUPP_GRP_TYPE, pdu, len);
 
 	last_handle = end;
-	for (l = database, groups = NULL; l; l = l->next) {
+	for (l = database, groups = NULL, cur = NULL; l; l = l->next) {
 		struct attribute *client_attr;
 
 		a = l->data;
@@ -538,6 +538,9 @@ static int find_info(uint16_t start, uint16_t end, uint8_t *pdu, int len)
 	} else if (last_type == BT_UUID128) {
 		length = 16;
 		format = 0x02;
+	} else {
+		g_slist_free(info);
+		return 0;
 	}
 
 	adl = att_data_list_alloc(num, length + 2);
-- 
1.7.4.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