Mercurial > pidgin.yaz
diff libpurple/protocols/myspace/myspace.c @ 29367:e137c1fc216a
Check if memory has been freed by looking at its contents does not work
100% of the time. If any of these functions are called with an invalid
object, then the correct fix is to determine why the function was called
and prevent it from being called.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 05 Feb 2010 01:18:18 +0000 |
parents | 52fffd4cdd62 |
children | 3e99c4eab63b |
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c Thu Feb 04 23:03:24 2010 +0000 +++ b/libpurple/protocols/myspace/myspace.c Fri Feb 05 01:18:18 2010 +0000 @@ -251,7 +251,6 @@ MsimMessage *msg; const gchar *from_username; - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); g_return_val_if_fail(who != NULL, FALSE); g_return_val_if_fail(text != NULL, FALSE); @@ -344,8 +343,6 @@ { guint rid; - g_return_val_if_fail(MSIM_SESSION_VALID(session), -1); - rid = session->next_rid++; g_hash_table_insert(session->user_lookup_cb, GUINT_TO_POINTER(rid), cb); @@ -394,8 +391,6 @@ gc = purple_account_get_connection(account); session = (MsimSession *)gc->proto_data; - g_return_val_if_fail(MSIM_SESSION_VALID(session), NULL); - display_name = headline = NULL; /* Retrieve display name and/or headline, depending on user preference. */ @@ -442,11 +437,9 @@ MsimSession *session; PurpleAccount *account = purple_buddy_get_account(buddy); PurpleConnection *gc = purple_account_get_connection(account); - + session = (MsimSession *)gc->proto_data; - g_return_if_fail(MSIM_SESSION_VALID(session)); - /* TODO: if (full), do something different? */ /* TODO: request information? have to figure out how to do @@ -694,7 +687,6 @@ gsize nc_len; gboolean ret; - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); g_return_val_if_fail(msg != NULL, FALSE); g_return_val_if_fail(msim_msg_get_binary(msg, "nc", &nc, &nc_len), FALSE); @@ -783,7 +775,6 @@ static gboolean msim_is_username_set(MsimSession *session, MsimMessage *msg) { - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); g_return_val_if_fail(msg != NULL, FALSE); g_return_val_if_fail(session->gc != NULL, FALSE); @@ -842,8 +833,6 @@ session = (MsimSession *)data; - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); - delta = time(NULL) - session->last_comm; /* purple_debug_info("msim", "msim_check_alive: delta=%d\n", delta); */ @@ -970,11 +959,6 @@ session = (MsimSession *)data; - if (!MSIM_SESSION_VALID(session)) { - purple_debug_info("msim", "msim_check_inbox: session invalid, stopping the mail check.\n"); - return FALSE; - } - purple_debug_info("msim", "msim_check_inbox: checking mail\n"); g_return_val_if_fail(msim_send(session, "persist", MSIM_TYPE_INTEGER, 1, @@ -1215,8 +1199,6 @@ { MsimMessage *body; - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); - /* Set display name to username (otherwise will show email address) */ purple_connection_set_display_name(session->gc, session->username); @@ -1382,7 +1364,6 @@ gchar *username; gchar *unrecognized_msg; - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); g_return_val_if_fail(msg != NULL, FALSE); /* Helpfully looked up by msim_incoming_resolve() for us. */ @@ -1577,7 +1558,6 @@ gchar *msg_text, *username; gboolean rc; - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); g_return_val_if_fail(msg != NULL, FALSE); msg_text = msim_msg_get_string(msg, "msg"); @@ -1797,7 +1777,6 @@ gpointer data; guint rid, cmd, dsn, lid; - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); g_return_val_if_fail(msg != NULL, FALSE); msim_store_user_info(session, msg, NULL); @@ -1848,7 +1827,6 @@ gchar *errmsg, *full_errmsg; guint err; - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); g_return_val_if_fail(msg != NULL, FALSE); err = msim_msg_get_integer(msg, "err"); @@ -1962,7 +1940,6 @@ gchar *username; MsimMessage *msg, *body; - g_return_if_fail(MSIM_SESSION_VALID(session)); g_return_if_fail(userinfo != NULL); body = msim_msg_get_dictionary(userinfo, "body"); @@ -1998,7 +1975,6 @@ static gboolean msim_preprocess_incoming(MsimSession *session, MsimMessage *msg) { - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); g_return_val_if_fail(msg != NULL, FALSE); if (msim_msg_get(msg, "bm") && msim_msg_get(msg, "f")) { @@ -2071,7 +2047,6 @@ } g_return_if_fail(cond == PURPLE_INPUT_READ); - g_return_if_fail(MSIM_SESSION_VALID(session)); /* Mark down that we got data, so we don't timeout. */ session->last_comm = time(NULL); @@ -2303,10 +2278,6 @@ gc->proto_data = NULL; - if (!MSIM_SESSION_VALID(session)) { - return; - } - if (session->gc->inpa) { purple_input_remove(session->gc->inpa); } @@ -2348,8 +2319,6 @@ session = (MsimSession *)gc->proto_data; - g_return_val_if_fail(MSIM_SESSION_VALID(session), -1); - message_msim = html_to_msim_markup(session, message); if (msim_send_bm(session, who, message_msim, MSIM_BM_ACTION_OR_IM_DELAYABLE)) { @@ -2390,8 +2359,6 @@ session = (MsimSession *)gc->proto_data; - g_return_val_if_fail(MSIM_SESSION_VALID(session), 0); - switch (state) { case PURPLE_TYPING: typing_str = "%typing%"; @@ -2421,8 +2388,6 @@ PurpleNotifyUserInfo *user_info; MsimUser *user; - g_return_if_fail(MSIM_SESSION_VALID(session)); - /* Get user{name,id} from msim_get_info, passed as an MsimMessage for orthogonality. */ msg = (MsimMessage *)data; @@ -2480,8 +2445,6 @@ session = (MsimSession *)gc->proto_data; - g_return_if_fail(MSIM_SESSION_VALID(session)); - /* Obtain uid of buddy. */ user = msim_find_user(session, username); @@ -2515,7 +2478,6 @@ static void msim_set_status_code(MsimSession *session, guint status_code, gchar *statstring) { - g_return_if_fail(MSIM_SESSION_VALID(session)); g_return_if_fail(statstring != NULL); purple_debug_info("msim", "msim_set_status_code: going to set status to code=%d,str=%s\n", @@ -2548,8 +2510,6 @@ session = (MsimSession *)account->gc->proto_data; - g_return_if_fail(MSIM_SESSION_VALID(session)); - type = purple_status_get_type(status); pres = purple_status_get_presence(status); @@ -2613,8 +2573,6 @@ session = (MsimSession *)gc->proto_data; - g_return_if_fail(MSIM_SESSION_VALID(session)); - status = purple_account_get_active_status(session->account); if (time == 0) { @@ -3005,8 +2963,6 @@ session = (MsimSession *)gc->proto_data; - g_return_val_if_fail(MSIM_SESSION_VALID(session), -1); - /* Loop until all data is sent, or a failure occurs. */ total_bytes_sent = 0; do { @@ -3041,7 +2997,6 @@ { size_t len; - g_return_val_if_fail(MSIM_SESSION_VALID(session), FALSE); g_return_val_if_fail(msg != NULL, FALSE); purple_debug_info("msim", "msim_send_raw: writing <%s>\n", msg);