libpurple/plugins/log_reader.c

changeset 39468
d615ac3cfbd3
parent 39461
a4ae05d3be93
child 39913
ce96d4639dc7
--- a/libpurple/plugins/log_reader.c	Wed Mar 13 00:03:02 2019 -0400
+++ b/libpurple/plugins/log_reader.c	Wed Mar 13 00:12:29 2019 -0400
@@ -621,6 +621,7 @@
 
 			while ((name = g_dir_read_name(dir))) {
 				const char *c = name;
+				gchar *full_path;
 
 				if (!purple_str_has_prefix(c, username))
 					continue;
@@ -633,16 +634,18 @@
 					c++;
 				}
 
-				path = g_build_filename(path, name, NULL);
+				full_path = g_build_filename(path, name, NULL);
 				if (purple_strequal(c, ".xml") &&
-				    g_file_test(path, G_FILE_TEST_EXISTS)) {
+				    g_file_test(full_path, G_FILE_TEST_EXISTS)) {
 					found = TRUE;
+					g_free(path);
+					path = full_path;
 					g_free(logfile);
 					logfile = g_strdup(name);
 					break;
 				}
 				else
-					g_free(path);
+					g_free(full_path);
 			}
 			g_dir_close(dir);
 		}

mercurial