diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2009-10-17 15:48:21 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2009-10-17 15:48:21 +0100 |
commit | 99c8f1357f1ab85f3a98727cb8877403d965e3da (patch) | |
tree | 0af79159117ebc7654a89783c6d6680b747bc293 | |
parent | e71cfbc35f3d2f3aa4da9e72776505d945429cbe (diff) |
Valgrind pointed me at some memory leaks in the Yahoo! codek, including one
that existed for a while already. Fixed.
-rw-r--r-- | protocols/yahoo/libyahoo2.c | 8 | ||||
-rw-r--r-- | protocols/yahoo/yahoo.c | 31 |
2 files changed, 22 insertions, 17 deletions
diff --git a/protocols/yahoo/libyahoo2.c b/protocols/yahoo/libyahoo2.c index 1d943df7..a1755cc9 100644 --- a/protocols/yahoo/libyahoo2.c +++ b/protocols/yahoo/libyahoo2.c @@ -2485,9 +2485,8 @@ static void yahoo_https_auth_finish(struct http_request *req) yahoo_packet_free(pack); - return; - fail: + g_free(crumb); g_free(had->token); g_free(had->chal); g_free(had); @@ -4134,7 +4133,10 @@ void yahoo_logoff(int id) LOG(("yahoo_logoff: current status: %d", yd->current_status)); - if(yd->current_status != -1) { + if(yd->current_status != -1 && 0) { + /* Meh. Don't send this. The event handlers are not going to + get to do this so it'll just leak memory. And the TCP + connection reset will hopefully be clear enough. */ pkt = yahoo_packet_new(YAHOO_SERVICE_LOGOFF, YAHOO_STATUS_AVAILABLE, yd->session_id); yd->current_status = -1; diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c index 96f619ed..ac57d4b6 100644 --- a/protocols/yahoo/yahoo.c +++ b/protocols/yahoo/yahoo.c @@ -253,20 +253,23 @@ static void byahoo_set_away( struct im_connection *ic, char *state, char *msg ) static GList *byahoo_away_states( struct im_connection *ic ) { - GList *m = NULL; - - m = g_list_append( m, "Available" ); - m = g_list_append( m, "Be Right Back" ); - m = g_list_append( m, "Busy" ); - m = g_list_append( m, "Not At Home" ); - m = g_list_append( m, "Not At Desk" ); - m = g_list_append( m, "Not In Office" ); - m = g_list_append( m, "On Phone" ); - m = g_list_append( m, "On Vacation" ); - m = g_list_append( m, "Out To Lunch" ); - m = g_list_append( m, "Stepped Out" ); - m = g_list_append( m, "Invisible" ); - m = g_list_append( m, GAIM_AWAY_CUSTOM ); + static GList *m = NULL; + + if( m == NULL ) + { + m = g_list_append( m, "Available" ); + m = g_list_append( m, "Be Right Back" ); + m = g_list_append( m, "Busy" ); + m = g_list_append( m, "Not At Home" ); + m = g_list_append( m, "Not At Desk" ); + m = g_list_append( m, "Not In Office" ); + m = g_list_append( m, "On Phone" ); + m = g_list_append( m, "On Vacation" ); + m = g_list_append( m, "Out To Lunch" ); + m = g_list_append( m, "Stepped Out" ); + m = g_list_append( m, "Invisible" ); + m = g_list_append( m, GAIM_AWAY_CUSTOM ); + } return m; } |