summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-adapter.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-05-04 21:32:18 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-05-04 21:32:18 +0000
commit76adbf6de1989fef3f6341e845ddf21fc08efe4a (patch)
tree8f64a27ee8e86684b69462a93bb84704ee3a1edf /hcid/dbus-adapter.c
parent5ef1e00f1c9d526f6c68ef064dbb4a1923e7320d (diff)
Fix two memory leaks with lmp_vertostr() usage
Diffstat (limited to 'hcid/dbus-adapter.c')
-rw-r--r--hcid/dbus-adapter.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c
index e2b05577..645ecaa9 100644
--- a/hcid/dbus-adapter.c
+++ b/hcid/dbus-adapter.c
@@ -1229,9 +1229,9 @@ static DBusHandlerResult adapter_get_remote_info(DBusConnection *conn,
dbus_message_iter_append_dict_entry(&dict, "manufacturer",
DBUS_TYPE_STRING, &ptr);
- ptr = lmp_vertostr(ver);
-
- snprintf(buf, 64, "Bluetooth %s", ptr);
+ str = lmp_vertostr(ver);
+ snprintf(buf, 64, "Bluetooth %s", str);
+ bt_free(str);
create_name(filename, PATH_MAX, STORAGEDIR,
adapter->address, "features");
@@ -1284,7 +1284,7 @@ static DBusHandlerResult adapter_get_remote_version(DBusConnection *conn,
DBusMessage *reply;
char filename[PATH_MAX + 1];
char *addr_ptr, *str;
- const char *str_ver;
+ char *str_ver = NULL;
char info_array[64], *info = info_array;
int compid, ver, subver;
@@ -1337,6 +1337,9 @@ static DBusHandlerResult adapter_get_remote_version(DBusConnection *conn,
free(str);
failed:
+ if (str_ver)
+ bt_free(str_ver);
+
reply = dbus_message_new_method_return(msg);
if (!reply)
return DBUS_HANDLER_RESULT_NEED_MEMORY;