diff mbox series

[BlueZ,6/9] profiles/input: Fix unchecked return value

Message ID 20211018172833.534191-7-hj.tedd.an@gmail.com (mailing list archive)
State Accepted
Delegated to: Luiz Von Dentz
Headers show
Series Fix unchecked return value | expand

Checks

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

Commit Message

Tedd Ho-Jeong An Oct. 18, 2021, 5:28 p.m. UTC
From: Tedd Ho-Jeong An <tedd.an@intel.com>

This patch fixes the unchecked return value(CWE-252) issues reported by
the Coverity.
---
 profiles/input/device.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/profiles/input/device.c b/profiles/input/device.c
index 50ae51855..013899211 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -1050,7 +1050,11 @@  static int hidp_add_connection(struct input_device *idev)
 	sprintf(handle, "0x%8.8X", idev->handle);
 
 	key_file = g_key_file_new();
-	g_key_file_load_from_file(key_file, filename, 0, NULL);
+	if (!g_key_file_load_from_file(key_file, filename, 0, &gerr)) {
+		error("Unable to load key file from %s: (%s)", filename,
+								gerr->message);
+		g_error_free(gerr);
+	}
 	str = g_key_file_get_string(key_file, "ServiceRecords", handle, NULL);
 	g_key_file_free(key_file);