[PATCH] Fix improper usage of g_free

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

 



g_free should be used for only those memory allocations
done through glib APIs
---
 client/advertising.c | 2 +-
 src/adapter.c        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/client/advertising.c b/client/advertising.c
index 045133a..5592be6 100644
--- a/client/advertising.c
+++ b/client/advertising.c
@@ -757,7 +757,7 @@ void ad_advertise_local_name(DBusConnection *conn, const char *name)
 		return;
 
 	g_free(ad.local_name);
-	ad.local_name = strdup(name);
+	ad.local_name = g_strdup(name);
 
 	g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, "LocalName");
 
diff --git a/src/adapter.c b/src/adapter.c
index c1c792a..07a4e42 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2258,7 +2258,7 @@ static bool parse_uuids(DBusMessageIter *value, struct discovery_filter *filter)
 		bt_uuid_to_uuid128(&uuid, &u128);
 		bt_uuid_to_string(&u128, uuidstr, sizeof(uuidstr));
 
-		filter->uuids = g_slist_prepend(filter->uuids, strdup(uuidstr));
+		filter->uuids = g_slist_prepend(filter->uuids, g_strdup(uuidstr));
 
 		dbus_message_iter_next(&arriter);
 	}
-- 
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