When storing an IRK the storage file may not have been created yet
since that uses the device address which is likely changed to the
identity address causing the following trace:
Invalid read of size 8
at 0x196452: store_irk.constprop.0 (adapter.c:8679)
by 0x198C92: new_irk_callback (adapter.c:8737)
by 0x1CF6DC: queue_foreach (queue.c:207)
by 0x1D1394: process_notify (mgmt.c:308)
by 0x1D1394: can_read_data (mgmt.c:374)
by 0x1E0634: watch_callback (io-glib.c:157)
by 0x4954A9E: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.6600.8)
by 0x49A6A97: ??? (in /usr/lib64/libglib-2.0.so.0.6600.8)
by 0x4954162: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.6600.8)
by 0x1E0CD4: mainloop_run (mainloop-glib.c:66)
by 0x1E10B1: mainloop_run_with_signal (mainloop-notify.c:188)
by 0x12E3FC: main (main.c:1210)
Address 0x6534418 is 8 bytes inside a block of size 16 free'd
Change-Id: I55ecfc9864003c6676029a024696addba04757cf
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
snprintf(filename, PATH_MAX, STORAGEDIR "/%s/%s/info",
btd_adapter_get_storage_dir(adapter), device_addr);
+ create_file(filename, 0600);
+
key_file = g_key_file_new();
if (!g_key_file_load_from_file(key_file, filename, 0, &gerr)) {
error("Unable to load key file from %s: (%s)", filename,
gerr->message);
g_clear_error(&gerr);
+ g_key_file_free(key_file);
+ return;
}
for (i = 0; i < 16; i++)