changeset 28138:deecc1d663c4

Don't use pointers (even opaquely) once they're freed. Closes #9822.
author Paul Aurich <paul@darkrain42.org>
date Sun, 02 Aug 2009 05:34:11 +0000
parents da33da2e1a1e
children 5b21007cf503
files libpurple/protocols/bonjour/mdns_avahi.c libpurple/protocols/jabber/disco.c libpurple/protocols/jabber/si.c libpurple/protocols/yahoo/yahoo_packet.c libpurple/signals.c pidgin/gtkblist.c pidgin/gtkimhtml.c pidgin/gtkthemes.c
diffstat 8 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/mdns_avahi.c	Sun Aug 02 05:04:41 2009 +0000
+++ b/libpurple/protocols/bonjour/mdns_avahi.c	Sun Aug 02 05:34:11 2009 +0000
@@ -200,8 +200,8 @@
 			}
 
 			if (!bonjour_buddy_check(bb)) {
+				b_impl->resolvers = g_slist_remove(b_impl->resolvers, rd);
 				_cleanup_resolver_data(rd);
-				b_impl->resolvers = g_slist_remove(b_impl->resolvers, rd);
 				/* If this was the last resolver, remove the buddy */
 				if (b_impl->resolvers == NULL) {
 					if (pb != NULL)
--- a/libpurple/protocols/jabber/disco.c	Sun Aug 02 05:04:41 2009 +0000
+++ b/libpurple/protocols/jabber/disco.c	Sun Aug 02 05:34:11 2009 +0000
@@ -85,11 +85,11 @@
 
 	/* TODO: When we support zeroconf proxies, fix this to handle them */
 	if (!(sh->jid && sh->host && sh->port > 0)) {
+		js->bs_proxies = g_list_remove(js->bs_proxies, sh);
 		g_free(sh->jid);
 		g_free(sh->host);
 		g_free(sh->zeroconf);
 		g_free(sh);
-		js->bs_proxies = g_list_remove(js->bs_proxies, sh);
 	}
 }
 
--- a/libpurple/protocols/jabber/si.c	Sun Aug 02 05:04:41 2009 +0000
+++ b/libpurple/protocols/jabber/si.c	Sun Aug 02 05:34:11 2009 +0000
@@ -1348,6 +1348,8 @@
 			fclose(jsx->fp);
 		}
 
+		purple_debug_info("jabber", "jabber_si_xfer_free(): freeing jsx %p\n", jsx);
+
 		g_free(jsx->stream_id);
 		g_free(jsx->iq_id);
 		/* XXX: free other stuff */
@@ -1355,7 +1357,6 @@
 		g_free(jsx);
 		xfer->data = NULL;
 
-		purple_debug_info("jabber", "jabber_si_xfer_free(): freeing jsx %p\n", jsx);
 	}
 }
 
--- a/libpurple/protocols/yahoo/yahoo_packet.c	Sun Aug 02 05:04:41 2009 +0000
+++ b/libpurple/protocols/yahoo/yahoo_packet.c	Sun Aug 02 05:34:11 2009 +0000
@@ -397,7 +397,7 @@
 		struct yahoo_pair *pair = pkt->hash->data;
 		g_free(pair->value);
 		g_free(pair);
-		pkt->hash = g_slist_remove(pkt->hash, pair);
+		pkt->hash = g_slist_delete_link(pkt->hash, pkt->hash);
 	}
 	g_free(pkt);
 }
--- a/libpurple/signals.c	Sun Aug 02 05:04:41 2009 +0000
+++ b/libpurple/signals.c	Sun Aug 02 05:34:11 2009 +0000
@@ -363,8 +363,8 @@
 		{
 			g_free(handler_data);
 
-			signal_data->handlers = g_list_remove(signal_data->handlers,
-												  handler_data);
+			signal_data->handlers = g_list_delete_link(signal_data->handlers,
+												       l);
 			signal_data->handler_count--;
 
 			found = TRUE;
@@ -398,8 +398,8 @@
 			g_free(handler_data);
 
 			signal_data->handler_count--;
-			signal_data->handlers = g_list_remove(signal_data->handlers,
-												  handler_data);
+			signal_data->handlers = g_list_delete_link(signal_data->handlers,
+			                                           l);
 		}
 	}
 }
--- a/pidgin/gtkblist.c	Sun Aug 02 05:04:41 2009 +0000
+++ b/pidgin/gtkblist.c	Sun Aug 02 05:34:11 2009 +0000
@@ -3560,7 +3560,7 @@
 			}
 
 			g_free(pce);
-			cur = g_list_remove(cur, pce);
+			cur = g_list_delete_link(cur, cur);
 		}
 	}
 	else if (PURPLE_BLIST_NODE_IS_CONTACT(node) || PURPLE_BLIST_NODE_IS_BUDDY(node))
--- a/pidgin/gtkimhtml.c	Sun Aug 02 05:04:41 2009 +0000
+++ b/pidgin/gtkimhtml.c	Sun Aug 02 05:34:11 2009 +0000
@@ -5838,9 +5838,9 @@
 		if (activate) {
 			return FALSE;
 		}
+		klass->protocols = g_list_remove(klass->protocols, proto);
 		g_free(proto->name);
 		g_free(proto);
-		klass->protocols = g_list_remove(klass->protocols, proto);
 		return TRUE;
 	} else if (!activate) {
 		return FALSE;
--- a/pidgin/gtkthemes.c	Sun Aug 02 05:04:41 2009 +0000
+++ b/pidgin/gtkthemes.c	Sun Aug 02 05:34:11 2009 +0000
@@ -183,7 +183,7 @@
 			}
 			g_free(uio->smile);
 			g_free(uio);
-			wer->smileys = g_slist_remove(wer->smileys, uio);
+			wer->smileys = g_slist_delete_link(wer->smileys, wer->smileys);
 		}
 		theme->list = wer->next;
 		g_free(wer->sml);