pidgin: 53aa3f79: Fix some webkit related leaks and an unn...
datallah at pidgin.im
datallah at pidgin.im
Sat Dec 31 12:05:47 EST 2011
----------------------------------------------------------------------
Revision: 53aa3f79eb4c3631876d9a54933658b3b5bac9ec
Parent: 70f2cea47f3e03cc6603ee85f8e5d5fba40bf214
Author: datallah at pidgin.im
Date: 12/31/11 10:48:20
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/53aa3f79eb4c3631876d9a54933658b3b5bac9ec
Changelog:
Fix some webkit related leaks and an unnecessary allocation.
Changes against parent 70f2cea47f3e03cc6603ee85f8e5d5fba40bf214
patched pidgin/gtkconv.c
-------------- next part --------------
============================================================
--- pidgin/gtkconv.c e2f6e7dbfe668ccf3dea3be13181f3201ea181f1
+++ pidgin/gtkconv.c fa1fa7e231f83163b59618783372810ccb4f94c3
@@ -5195,11 +5195,11 @@ conv_variant_changed_cb(GObject *gobject
conv_variant_changed_cb(GObject *gobject, GParamSpec *pspec, gpointer user_data)
{
PidginConversation *gtkconv = user_data;
- const char *path;
- char *js;
+ char *path, *js;
path = pidgin_conversation_theme_get_css_path(PIDGIN_CONV_THEME(gobject));
js = g_strdup_printf("setStylesheet(\"mainStyle\", \"file://%s\");", path);
+ g_free(path);
gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), js);
g_free(js);
}
@@ -6097,13 +6097,14 @@ replace_message_tokens(
const char *cur = text;
const char *prev = cur;
- if (text == NULL)
- return g_strdup("");
+ if (text == NULL || *text == '\0')
+ return NULL;
str = g_string_new(NULL);
while ((cur = strchr(cur, '%'))) {
const char *replace = NULL;
const char *fin = NULL;
+ gpointer freeval = NULL;
if (g_str_has_prefix(cur, "%message%")) {
replace = message;
@@ -6139,14 +6140,14 @@ replace_message_tokens(
replace = purple_imgstore_get_filename(img);
}
if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) {
- replace = g_build_filename("Outgoing", "buddy_icon.png", NULL);
+ replace = freeval = g_build_filename("Outgoing", "buddy_icon.png", NULL);
}
} else if (flags & PURPLE_MESSAGE_RECV) {
PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv));
if (icon)
replace = purple_buddy_icon_get_full_path(icon);
if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) {
- replace = g_build_filename("Incoming", "buddy_icon.png", NULL);
+ replace = freeval = g_build_filename("Incoming", "buddy_icon.png", NULL);
}
}
@@ -6171,6 +6172,8 @@ replace_message_tokens(
g_string_append_len(str, prev, cur - prev);
if (replace)
g_string_append(str, replace);
+ g_free(freeval);
+ freeval = replace = NULL;
/* And update the pointers */
if (fin) {
@@ -6294,7 +6297,7 @@ pidgin_conv_write_conv(PurpleConversatio
smileyed = smiley_parse_markup(message, purple_account_get_protocol_id(account));
msg = replace_message_tokens(message_html, conv, name, alias, smileyed, flags, mtime);
- escape = gtk_webview_quote_js_string(msg);
+ escape = gtk_webview_quote_js_string(msg ? msg : "");
script = g_strdup_printf("%s(%s)", func, escape);
purple_debug_info("webkit", "JS: %s\n", script);
More information about the Commits
mailing list