diff mcabber/src/jabglue.c @ 1072:2a3cfb98bd5e

Fix memory leaks after calls to buddy_getresources()
author Mikael Berthe <mikael@lilotux.net>
date Sun, 03 Dec 2006 19:29:50 +0100
parents 866be086cc9b
children 10f9d6fcfeab
line wrap: on
line diff
--- a/mcabber/src/jabglue.c	Sun Dec 03 12:00:17 2006 +0100
+++ b/mcabber/src/jabglue.c	Sun Dec 03 19:29:50 2006 +0100
@@ -998,7 +998,7 @@
 
 void jb_request(const char *fjid, enum iqreq_type reqtype)
 {
-  GSList *resources;
+  GSList *resources, *p_res;
   GSList *roster_elt;
   void (*request_fn)(const char *);
   const char *strreqtype;
@@ -1049,13 +1049,15 @@
     (*request_fn)(fjid); // Let's send a request anyway...
     scr_LogPrint(LPRINT_NORMAL, "Sent %s request to <%s>", strreqtype, fjid);
   }
-  for ( ; resources ; resources = g_slist_next(resources) ) {
+  for (p_res = resources ; p_res ; p_res = g_slist_next(p_res)) {
     gchar *fulljid;
-    fulljid = g_strdup_printf("%s/%s", fjid, (char*)resources->data);
+    fulljid = g_strdup_printf("%s/%s", fjid, (char*)p_res->data);
     (*request_fn)(fulljid);
     scr_LogPrint(LPRINT_NORMAL, "Sent %s request to <%s>", strreqtype, fulljid);
     g_free(fulljid);
+    g_free(p_res->data);
   }
+  g_slist_free(resources);
 }
 
 // Join a MUC room