Mercurial > pidgin.yaz
diff libpurple/protocols/bonjour/jabber.c @ 15812:71b017348c39
plug some memory leaks
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sat, 17 Mar 2007 17:55:22 +0000 |
parents | 5fe8042783c1 |
children | 32c366eeeb99 |
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/jabber.c Sat Mar 17 17:48:34 2007 +0000 +++ b/libpurple/protocols/bonjour/jabber.c Sat Mar 17 17:55:22 2007 +0000 @@ -531,10 +531,10 @@ xmlnode *message_x_node = NULL; GaimBuddy *gb = NULL; BonjourBuddy *bb = NULL; - char *conv_message = NULL; GaimConversation *conversation = NULL; char *message_from_ui = NULL; char *stripped_message = NULL; + gint ret; gb = gaim_find_buddy(data->account, to); if (gb == NULL) @@ -547,9 +547,11 @@ message_body_node = xmlnode_new("body"); stripped_message = gaim_markup_strip_html(body); xmlnode_insert_data(message_body_node, stripped_message, strlen(stripped_message)); + g_free(stripped_message); message_from_ui = g_strconcat("<font>", body, "</font>", NULL); message_html_body_font_node = xmlnode_from_str(message_from_ui, strlen(message_from_ui)); + g_free(message_from_ui); message_html_body_node = xmlnode_new("body"); xmlnode_insert_child(message_html_body_node, message_html_body_font_node); @@ -571,6 +573,7 @@ xmlnode_insert_child(message_node, message_x_node); message = xmlnode_to_str(message_node, &message_length); + xmlnode_free(message_node); /* Check if there is a previously open conversation */ if (bb->conversation == NULL) @@ -591,9 +594,10 @@ { gaim_debug_error("bonjour", "Unable to start a conversation\n"); gaim_debug_warning("bonjour", "send error: %s\n", strerror(errno)); - conv_message = g_strdup(_("Unable to send the message, the conversation couldn't be started.")); conversation = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, bb->name, data->account); - gaim_conversation_write(conversation, NULL, conv_message, GAIM_MESSAGE_SYSTEM, time(NULL)); + gaim_conversation_write(conversation, NULL, + _("Unable to send the message, the conversation couldn't be started."), + GAIM_MESSAGE_SYSTEM, time(NULL)); close(bb->conversation->socket); gaim_input_remove(bb->conversation->watcher_id); @@ -601,6 +605,7 @@ g_free(bb->conversation->buddy_name); g_free(bb->conversation); bb->conversation = NULL; + g_free(message); return 0; } @@ -608,7 +613,10 @@ } /* Send the message */ - if (_send_data(bb->conversation->socket, message) == -1) + ret = _send_data(bb->conversation->socket, message) == -1; + g_free(message); + + if (ret == -1) return -10000; return 1;