pidgin/pidgin

Fix some issues scanbuild found in the log reader plugin
release-2.x.y
2021-06-01, Gary Kramlich
8aafbbfc4f42
Parents c997d298cd4c
Children 8b3be4e34e27
Fix some issues scanbuild found in the log reader plugin

Testing Done:
Verified scanbuild no longer detected the error.

Reviewed at https://reviews.imfreedom.org/r/699/
--- 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);
}