comparison src/protocols/msn/servconn.c @ 5897:e3733414ca08

[gaim-migrate @ 6329] Fixed the MSN segfault on XFR, where we were accessing a servconn that was destroyed, due to it being the old notification server that was replaced during XFR. Did that make sense to anybody? committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 15 Jun 2003 19:23:59 +0000
parents 952710ac6635
children 5baeb89ee2d4
comparison
equal deleted inserted replaced
5896:a156d08e481e 5897:e3733414ca08
52 } 52 }
53 53
54 static gboolean 54 static gboolean
55 process_single_line(MsnServConn *servconn, char *str) 55 process_single_line(MsnServConn *servconn, char *str)
56 { 56 {
57 MsnSession *session = servconn->session;
57 MsnServConnCommandCb cb; 58 MsnServConnCommandCb cb;
58 GSList *l, *l_next; 59 GSList *l, *l_next = NULL;
59 gboolean result; 60 gboolean result;
60 size_t param_count = 0; 61 size_t param_count = 0;
61 char *command, *param_start; 62 char *command, *param_start;
62 char **params = NULL; 63 char **params = NULL;
64 MsnServConn *old_notification_conn;
63 65
64 command = str; 66 command = str;
67
68 old_notification_conn = session->notification_conn;
65 69
66 /** 70 /**
67 * See how many spaces we have in this. 71 * See how many spaces we have in this.
68 */ 72 */
69 param_start = strchr(command, ' '); 73 param_start = strchr(command, ' ');
96 result = cb(servconn, command, (const char **)params, param_count); 100 result = cb(servconn, command, (const char **)params, param_count);
97 101
98 if (params != NULL) 102 if (params != NULL)
99 g_strfreev(params); 103 g_strfreev(params);
100 104
101 105 /*
106 * We're checking here if the old notification server was replaced
107 * with a new one, and if the current servconn here is the old
108 * notification server. If so, we're going to have a bit of trouble
109 * in the upcoming loop, as servconn will be a freed variable, so
110 * we'll just return early.
111 */
112 if (servconn == old_notification_conn &&
113 old_notification_conn != session->notification_conn) {
114
115 return result;
116 }
117
102 /* Process all queued messages that are waiting on this command. */ 118 /* Process all queued messages that are waiting on this command. */
103 for (l = servconn->msg_queue; l != NULL; l = l_next) { 119 for (l = servconn->msg_queue; l != NULL; l = l_next) {
104 MsnQueueEntry *entry = l->data; 120 MsnQueueEntry *entry = l->data;
105 MsnMessage *msg; 121 MsnMessage *msg;
106 122