diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-09-16 15:18:14 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-09-17 12:49:50 -0700 |
commit | 36e4ce9076bf63c3729610584a2dadb9dd52b810 (patch) | |
tree | 5d2a8fc9df5c9098ed28b080ea97b647e79dbaad /plugins | |
parent | f7eb887f4eb2558bf97c1f88a9fff37868ae44ae (diff) | |
download | bluez-36e4ce9076bf63c3729610584a2dadb9dd52b810.tar.gz |
admin: Fix leaking uuids loads from storage
This fixes the following trace:
8 bytes in 1 blocks are definitely lost in loss record 27 of 274
at 0x4839809: malloc (vg_replace_malloc.c:307)
by 0x495BBB8: g_malloc (in /usr/lib64/libglib-2.0.so.0.6600.8)
by 0x494C024: g_key_file_get_string_list (in /usr/lib64/libglib-2.0.so.0.6600.8)
by 0x131ECD: key_file_load_service_allowlist (admin.c:294)
by 0x131ECD: load_policy_settings (admin.c:346)
by 0x131ECD: admin_policy_adapter_probe (admin.c:497)
by 0x18F554: probe_driver (adapter.c:4858)
by 0x19DF5A: load_drivers (adapter.c:4873)
by 0x19DF5A: adapter_register (adapter.c:8975)
by 0x19DF5A: read_info_complete (adapter.c:9791)
by 0x1CE831: request_complete (mgmt.c:264)
by 0x1CF7D4: can_read_data (mgmt.c:356)
by 0x1DE634: watch_callback (io-glib.c:157)
by 0x4953A9E: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.6600.8)
by 0x49A5A97: ??? (in /usr/lib64/libglib-2.0.so.0.6600.8)
by 0x4953162: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.6600.8)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/admin.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/admin.c b/plugins/admin.c index 8390f3c32..c232c057c 100644 --- a/plugins/admin.c +++ b/plugins/admin.c @@ -12,6 +12,7 @@ #include <config.h> #endif +#include <stdlib.h> #include <dbus/dbus.h> #include <gdbus/gdbus.h> #include <sys/file.h> @@ -74,7 +75,7 @@ static struct btd_admin_policy *admin_policy_new(struct btd_adapter *adapter) static void free_service_allowlist(struct queue *q) { - queue_destroy(q, g_free); + queue_destroy(q, free); } static void admin_policy_free(void *data) @@ -307,7 +308,7 @@ static void key_file_load_service_allowlist(GKeyFile *key_file, if (!uuid) goto failed; - if (bt_string_to_uuid(uuid, *uuids)) { + if (bt_string_to_uuid(uuid, uuids[i])) { btd_error(admin_policy->adapter_id, "Failed to convert '%s' to uuid struct", @@ -318,14 +319,16 @@ static void key_file_load_service_allowlist(GKeyFile *key_file, } queue_push_tail(uuid_list, uuid); - uuids++; } if (!service_allowlist_set(admin_policy, uuid_list)) goto failed; + g_strfreev(uuids); + return; failed: + g_strfreev(uuids); free_service_allowlist(uuid_list); } |