From fa1b565385454f05b5b3a5bf496622659e2cf0ff Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Wed, 7 Mar 2012 10:47:46 +0100 Subject: [PATCH] Use g_free for freeing glibs data --- backends/libpurple/main.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/backends/libpurple/main.cpp b/backends/libpurple/main.cpp index cf8d3090..e25d093e 100644 --- a/backends/libpurple/main.cpp +++ b/backends/libpurple/main.cpp @@ -89,7 +89,7 @@ static std::string KEYFILE_STRING(const std::string &cat, const std::string &key return def; } std::string ret(str); - free(str); + g_free(str); if (ret.find("#") != std::string::npos) { ret = ret.substr(0, ret.find("#")); @@ -1407,11 +1407,13 @@ static void *notify_user_info(PurpleConnection *gc, const char *who, PurpleNotif if (true) { gchar *data; gchar *path = purple_buddy_icon_get_full_path(icon); - if (g_file_get_contents (path, &data, &len, NULL)) { - photo = std::string(data, len); - free(data); + if (path) { + if (g_file_get_contents(path, &data, &len, NULL)) { + photo = std::string(data, len); + g_free(data); + } + g_free(path); } - free(path); } else { const gchar * data = (gchar*)purple_buddy_icon_get_data(icon, &len);