From da2aa47039950f51b55c57bb689f0c99b48dd475 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 12 Mar 2019 05:51:08 -0400 Subject: [PATCH] Fix several g_build_filename leaks. --- libpurple/buddyicon.c | 2 +- libpurple/log.c | 1 + libpurple/plugins/log_reader.c | 4 +--- pidgin/gtkconv-theme.c | 1 + pidgin/gtkicon-theme-loader.c | 1 + pidgin/gtksmiley-theme.c | 3 +++ 6 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libpurple/buddyicon.c b/libpurple/buddyicon.c index b958146bcc..4c6e9a0b05 100644 --- a/libpurple/buddyicon.c +++ b/libpurple/buddyicon.c @@ -158,7 +158,6 @@ purple_buddy_icon_data_cache(PurpleImage *img) dirname = purple_buddy_icons_get_cache_dir(); filename = image_get_filename(img); g_return_if_fail(filename != NULL); - path = g_build_filename(dirname, filename, NULL); if (!g_file_test(dirname, G_FILE_TEST_IS_DIR)) { @@ -173,6 +172,7 @@ purple_buddy_icon_data_cache(PurpleImage *img) } } + path = g_build_filename(dirname, filename, NULL); if (!purple_image_save(img, path)) purple_debug_error("buddyicon", "failed to save icon %s", path); diff --git a/libpurple/log.c b/libpurple/log.c index e3d9c99b57..1ce3348641 100644 --- a/libpurple/log.c +++ b/libpurple/log.c @@ -834,6 +834,7 @@ convert_image_tags(const PurpleLog *log, const char *msg) /* Write the new image tag */ g_string_append_printf(newmsg, "", new_filename); g_free(path); + g_free(dir); } /* Continue from the end of the tag */ diff --git a/libpurple/plugins/log_reader.c b/libpurple/plugins/log_reader.c index 5cac5c612f..4a53f30900 100644 --- a/libpurple/plugins/log_reader.c +++ b/libpurple/plugins/log_reader.c @@ -594,11 +594,9 @@ static GList *msn_logger_list(PurpleLogType type, const char *sn, PurpleAccount found = TRUE; break; } - g_free(path); g_free(history_path); } - else - g_free(path); + g_free(path); } g_dir_close(dir); } diff --git a/pidgin/gtkconv-theme.c b/pidgin/gtkconv-theme.c index 698b794568..f453f1f55c 100644 --- a/pidgin/gtkconv-theme.c +++ b/pidgin/gtkconv-theme.c @@ -350,6 +350,7 @@ get_outgoing_next_content_html(PidginConvThemePrivate *priv, const char *dir) if (!g_file_get_contents(file, &priv->outgoing_next_content_html, NULL, NULL)) { priv->outgoing_next_content_html = g_strdup(get_outgoing_content_html(priv, dir)); } + g_free(file); return priv->outgoing_next_content_html; } diff --git a/pidgin/gtkicon-theme-loader.c b/pidgin/gtkicon-theme-loader.c index a7c64104be..0101875378 100644 --- a/pidgin/gtkicon-theme-loader.c +++ b/pidgin/gtkicon-theme-loader.c @@ -81,6 +81,7 @@ pidgin_icon_loader_build(const gchar *theme_dir) purple_xmlnode_free(root_node); g_free(data); + g_free(dir); return PURPLE_THEME(theme); } diff --git a/pidgin/gtksmiley-theme.c b/pidgin/gtksmiley-theme.c index 8d7c10ffb4..e05d1cfc05 100644 --- a/pidgin/gtksmiley-theme.c +++ b/pidgin/gtksmiley-theme.c @@ -483,6 +483,7 @@ pidgin_smiley_theme_activate_impl(PurpleSmileyTheme *theme) if (!g_file_test(smiley_path, G_FILE_TEST_EXISTS)) { purple_debug_warning("gtksmiley-theme", "Smiley %s is missing", smiley_path); + g_free(smiley_path); continue; } @@ -500,6 +501,8 @@ pidgin_smiley_theme_activate_impl(PurpleSmileyTheme *theme) purple_smiley_list_add(proto_smileys, smiley); g_object_unref(smiley); } + + g_free(smiley_path); } } -- 2.11.4.GIT