[PATCH BlueZ 3/3] input: Fix incorrect destructors being used

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

 



g_key_file_get_string() expects its value to be freed with g_free(), not
free().

Fixes:
profiles/input/manager.c:118:2: leaked_storage: Variable "uhid_enabled" going out of scope leaks the storage it points to.
profiles/input/hog.c:267:1: leaked_storage: Variable "uhid_enabled" going out of scope leaks the storage it points to.
---
 profiles/input/hog.c     | 2 +-
 profiles/input/manager.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index f5d24aad67e2..1f5b82b77435 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -259,7 +259,7 @@ static void hog_read_config(void)
 	if (!err) {
 		DBG("input.conf: UserspaceHID=%s", uhid_enabled);
 		uhid_state_persist = strcasecmp(uhid_enabled, "persist") == 0;
-		free(uhid_enabled);
+		g_free(uhid_enabled);
 	} else
 		g_clear_error(&err);
 
diff --git a/profiles/input/manager.c b/profiles/input/manager.c
index d0db13f2d3e9..b0e415f6706c 100644
--- a/profiles/input/manager.c
+++ b/profiles/input/manager.c
@@ -101,7 +101,7 @@ static int input_init(void)
 		if (!err) {
 			DBG("input.conf: UserspaceHID=%s", uhid_enabled);
 			input_set_userspace_hid(uhid_enabled);
-			free(uhid_enabled);
+			g_free(uhid_enabled);
 		} else
 			g_clear_error(&err);
 
-- 
2.50.1





[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