diff mbox series

[BlueZ,3/3] client: Fix uninitiailzed scalar variable

Message ID 20211113023559.212793-3-hj.tedd.an@gmail.com (mailing list archive)
State Accepted
Delegated to: Luiz Von Dentz
Headers show
Series [BlueZ,1/3] emulator: Fix uninitiailzed scalar variable | expand

Checks

Context Check Description
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS

Commit Message

Tedd Ho-Jeong An Nov. 13, 2021, 2:35 a.m. UTC
From: Tedd Ho-Jeong An <tedd.an@intel.com>

This patch fixes the uninitiailzed varialble(CWE-457) reported by
the Coverity scan.
---
 client/gatt.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/client/gatt.c b/client/gatt.c
index ce13b3341..9c991c2ac 100644
--- a/client/gatt.c
+++ b/client/gatt.c
@@ -175,6 +175,7 @@  static void print_service_proxy(GDBusProxy *proxy, const char *description)
 
 	dbus_message_iter_get_basic(&iter, &primary);
 
+	memset(&service, 0, sizeof(service));
 	service.path = (char *) g_dbus_proxy_get_path(proxy);
 	service.uuid = (char *) uuid;
 	service.primary = primary;
@@ -257,6 +258,7 @@  static void print_characteristic(GDBusProxy *proxy, const char *description)
 
 	dbus_message_iter_get_basic(&iter, &uuid);
 
+	memset(&chrc, 0, sizeof(chrc));
 	chrc.path = (char *) g_dbus_proxy_get_path(proxy);
 	chrc.uuid = (char *) uuid;
 
@@ -350,6 +352,7 @@  static void print_descriptor(GDBusProxy *proxy, const char *description)
 
 	dbus_message_iter_get_basic(&iter, &uuid);
 
+	memset(&desc, 0, sizeof(desc));
 	desc.path = (char *) g_dbus_proxy_get_path(proxy);
 	desc.uuid = (char *) uuid;