--- a/libpurple/plugins/log_reader.c Tue Jun 01 20:13:53 2021 -0500 +++ b/libpurple/plugins/log_reader.c Tue Jun 01 20:14:36 2021 -0500 @@ -769,6 +769,7 @@ const gchar *name; while ((name = g_dir_read_name(dir))) { + gchar *file_path = NULL; const char *c = name; if (!purple_str_has_prefix(c, username)) @@ -782,16 +783,22 @@ c++; } - path = g_build_filename(path, name, NULL); + file_path = g_build_filename(path, name, NULL); if (purple_strequal(c, ".xml") && - g_file_test(path, G_FILE_TEST_EXISTS)) { + g_file_test(file_path, G_FILE_TEST_EXISTS)) + { found = TRUE; + + g_free(path); + path = file_path; + g_free(logfile); logfile = g_strdup(name); + break; + } else { + g_free(file_path); } - else - g_free(path); } g_dir_close(dir); }