comparison 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
comparison
equal deleted inserted replaced
1071:866be086cc9b 1072:2a3cfb98bd5e
996 g_free(cleanjid); 996 g_free(cleanjid);
997 } 997 }
998 998
999 void jb_request(const char *fjid, enum iqreq_type reqtype) 999 void jb_request(const char *fjid, enum iqreq_type reqtype)
1000 { 1000 {
1001 GSList *resources; 1001 GSList *resources, *p_res;
1002 GSList *roster_elt; 1002 GSList *roster_elt;
1003 void (*request_fn)(const char *); 1003 void (*request_fn)(const char *);
1004 const char *strreqtype; 1004 const char *strreqtype;
1005 1005
1006 if (reqtype == iqreq_version) { 1006 if (reqtype == iqreq_version) {
1047 if (!resources) { 1047 if (!resources) {
1048 scr_LogPrint(LPRINT_NORMAL, "No known resource for <%s>...", fjid); 1048 scr_LogPrint(LPRINT_NORMAL, "No known resource for <%s>...", fjid);
1049 (*request_fn)(fjid); // Let's send a request anyway... 1049 (*request_fn)(fjid); // Let's send a request anyway...
1050 scr_LogPrint(LPRINT_NORMAL, "Sent %s request to <%s>", strreqtype, fjid); 1050 scr_LogPrint(LPRINT_NORMAL, "Sent %s request to <%s>", strreqtype, fjid);
1051 } 1051 }
1052 for ( ; resources ; resources = g_slist_next(resources) ) { 1052 for (p_res = resources ; p_res ; p_res = g_slist_next(p_res)) {
1053 gchar *fulljid; 1053 gchar *fulljid;
1054 fulljid = g_strdup_printf("%s/%s", fjid, (char*)resources->data); 1054 fulljid = g_strdup_printf("%s/%s", fjid, (char*)p_res->data);
1055 (*request_fn)(fulljid); 1055 (*request_fn)(fulljid);
1056 scr_LogPrint(LPRINT_NORMAL, "Sent %s request to <%s>", strreqtype, fulljid); 1056 scr_LogPrint(LPRINT_NORMAL, "Sent %s request to <%s>", strreqtype, fulljid);
1057 g_free(fulljid); 1057 g_free(fulljid);
1058 } 1058 g_free(p_res->data);
1059 }
1060 g_slist_free(resources);
1059 } 1061 }
1060 1062
1061 // Join a MUC room 1063 // Join a MUC room
1062 void jb_room_join(const char *room, const char *nickname, const char *passwd) 1064 void jb_room_join(const char *room, const char *nickname, const char *passwd)
1063 { 1065 {