pidgin: 85ba052c: yahoo: Fix some "leaks" (in reality thes...
darkrain42 at pidgin.im
darkrain42 at pidgin.im
Sun Aug 2 01:41:04 EDT 2009
-----------------------------------------------------------------
Revision: 85ba052cd9c6d114ae61bebd086e1af59dd7f6ca
Ancestor: b3328cd5c5c4ce54e652aa6c9a5b8401391e2ec6
Author: darkrain42 at pidgin.im
Date: 2009-08-02T04:10:32
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/85ba052cd9c6d114ae61bebd086e1af59dd7f6ca
Modified files:
libpurple/protocols/yahoo/yahoo_filexfer.c
ChangeLog:
yahoo: Fix some "leaks" (in reality these shouldn't happen). Refs #9822.
-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo_filexfer.c 10dc0fdf90132ea7c6cc29e89662979512ca67d5
+++ libpurple/protocols/yahoo/yahoo_filexfer.c 04618d50e00b44ab33a6c0585ca6b022eb90d5d9
@@ -884,46 +884,48 @@ void yahoo_process_filetransfer(PurpleCo
/* Build the file transfer handle. */
xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, from);
- if (xfer)
- {
- xfer->data = xfer_data;
+ if (xfer == NULL) {
+ g_free(xfer_data);
+ g_return_if_reached();
+ }
- /* Set the info about the incoming file. */
- if (filename) {
- char *utf8_filename = yahoo_string_decode(gc, filename, TRUE);
+ xfer->data = xfer_data;
+
+ /* Set the info about the incoming file. */
+ if (filename) {
+ char *utf8_filename = yahoo_string_decode(gc, filename, TRUE);
+ purple_xfer_set_filename(xfer, utf8_filename);
+ g_free(utf8_filename);
+ } else {
+ gchar *start, *end;
+ start = g_strrstr(xfer_data->path, "/");
+ if (start)
+ start++;
+ end = g_strrstr(xfer_data->path, "?");
+ if (start && *start && end) {
+ char *utf8_filename;
+ filename = g_strndup(start, end - start);
+ utf8_filename = yahoo_string_decode(gc, filename, TRUE);
+ g_free(filename);
purple_xfer_set_filename(xfer, utf8_filename);
g_free(utf8_filename);
- } else {
- gchar *start, *end;
- start = g_strrstr(xfer_data->path, "/");
- if (start)
- start++;
- end = g_strrstr(xfer_data->path, "?");
- if (start && *start && end) {
- char *utf8_filename;
- filename = g_strndup(start, end - start);
- utf8_filename = yahoo_string_decode(gc, filename, TRUE);
- g_free(filename);
- purple_xfer_set_filename(xfer, utf8_filename);
- g_free(utf8_filename);
- filename = NULL;
- }
+ filename = NULL;
}
+ }
- purple_xfer_set_size(xfer, filesize);
+ purple_xfer_set_size(xfer, filesize);
- /* Setup our I/O op functions */
- purple_xfer_set_init_fnc(xfer, yahoo_xfer_init);
- purple_xfer_set_start_fnc(xfer, yahoo_xfer_start);
- purple_xfer_set_end_fnc(xfer, yahoo_xfer_end);
- purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send);
- purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv);
- purple_xfer_set_read_fnc(xfer, yahoo_xfer_read);
- purple_xfer_set_write_fnc(xfer, yahoo_xfer_write);
+ /* Setup our I/O op functions */
+ purple_xfer_set_init_fnc(xfer, yahoo_xfer_init);
+ purple_xfer_set_start_fnc(xfer, yahoo_xfer_start);
+ purple_xfer_set_end_fnc(xfer, yahoo_xfer_end);
+ purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send);
+ purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv);
+ purple_xfer_set_read_fnc(xfer, yahoo_xfer_read);
+ purple_xfer_set_write_fnc(xfer, yahoo_xfer_write);
- /* Now perform the request */
- purple_xfer_request(xfer);
- }
+ /* Now perform the request */
+ purple_xfer_request(xfer);
}
PurpleXfer *yahoo_new_xfer(PurpleConnection *gc, const char *who)
@@ -938,20 +940,23 @@ PurpleXfer *yahoo_new_xfer(PurpleConnect
/* Build the file transfer handle. */
xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who);
- if (xfer)
+ if (xfer == NULL)
{
- xfer->data = xfer_data;
+ g_free(xfer_data);
+ g_return_val_if_reached(NULL);
+ }
- /* Setup our I/O op functions */
- purple_xfer_set_init_fnc(xfer, yahoo_xfer_init);
- purple_xfer_set_start_fnc(xfer, yahoo_xfer_start);
- purple_xfer_set_end_fnc(xfer, yahoo_xfer_end);
- purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send);
- purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv);
- purple_xfer_set_read_fnc(xfer, yahoo_xfer_read);
- purple_xfer_set_write_fnc(xfer, yahoo_xfer_write);
- }
+ xfer->data = xfer_data;
+ /* Setup our I/O op functions */
+ purple_xfer_set_init_fnc(xfer, yahoo_xfer_init);
+ purple_xfer_set_start_fnc(xfer, yahoo_xfer_start);
+ purple_xfer_set_end_fnc(xfer, yahoo_xfer_end);
+ purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send);
+ purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv);
+ purple_xfer_set_read_fnc(xfer, yahoo_xfer_read);
+ purple_xfer_set_write_fnc(xfer, yahoo_xfer_write);
+
return xfer;
}
@@ -1588,6 +1593,7 @@ void yahoo_process_filetrans_15(PurpleCo
char *service = NULL;
char *filename = NULL;
char *xfer_peer_idstring = NULL;
+ char *utf8_filename
unsigned long filesize = 0L;
GSList *l;
GSList *filename_list = NULL;
@@ -1714,42 +1720,44 @@ void yahoo_process_filetrans_15(PurpleCo
/* Build the file transfer handle. */
xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, from);
+ if (xfer == NULL)
+ {
+ g_free(xfer_data);
+ g_return_if_reached();
+ }
+
xfer->message = NULL;
- if (xfer)
- {
- /* Set the info about the incoming file. */
- char *utf8_filename = yahoo_string_decode(gc, filename, TRUE);
- purple_xfer_set_filename(xfer, utf8_filename);
- g_free(utf8_filename);
- purple_xfer_set_size(xfer, filesize);
+ /* Set the info about the incoming file. */
+ utf8_filename = yahoo_string_decode(gc, filename, TRUE);
+ purple_xfer_set_filename(xfer, utf8_filename);
+ g_free(utf8_filename);
+ purple_xfer_set_size(xfer, filesize);
- xfer->data = xfer_data;
+ xfer->data = xfer_data;
+ /* Setup our I/O op functions */
+ purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15);
+ purple_xfer_set_start_fnc(xfer, yahoo_xfer_start);
+ purple_xfer_set_end_fnc(xfer, yahoo_xfer_end);
+ purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send);
+ purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv);
+ purple_xfer_set_read_fnc(xfer, yahoo_xfer_read);
+ purple_xfer_set_write_fnc(xfer, yahoo_xfer_write);
+ purple_xfer_set_request_denied_fnc(xfer,yahoo_xfer_cancel_recv);
- /* Setup our I/O op functions */
- purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15);
- purple_xfer_set_start_fnc(xfer, yahoo_xfer_start);
- purple_xfer_set_end_fnc(xfer, yahoo_xfer_end);
- purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send);
- purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv);
- purple_xfer_set_read_fnc(xfer, yahoo_xfer_read);
- purple_xfer_set_write_fnc(xfer, yahoo_xfer_write);
- purple_xfer_set_request_denied_fnc(xfer,yahoo_xfer_cancel_recv);
+ g_hash_table_insert(yd->xfer_peer_idstring_map,
+ xfer_data->xfer_peer_idstring,
+ xfer);
- g_hash_table_insert(yd->xfer_peer_idstring_map,
- xfer_data->xfer_peer_idstring,
- xfer);
-
- if(nooffiles > 1) {
- gchar* message;
- message = g_strdup_printf(_("%s is trying to send you a group of %d files.\n"), xfer->who, nooffiles);
- purple_xfer_conversation_write(xfer, message, FALSE);
- g_free(message);
- }
- /* Now perform the request */
- purple_xfer_request(xfer);
+ if(nooffiles > 1) {
+ gchar* message;
+ message = g_strdup_printf(_("%s is trying to send you a group of %d files.\n"), xfer->who, nooffiles);
+ purple_xfer_conversation_write(xfer, message, FALSE);
+ g_free(message);
}
+ /* Now perform the request */
+ purple_xfer_request(xfer);
}
void yahoo_process_filetrans_info_15(PurpleConnection *gc, struct yahoo_packet *pkt)
More information about the Commits
mailing list