@@ -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);
}
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> 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) --- plugins/admin.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)