comparison mcabber/src/screen.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 875d2c9d399c
children 03bc225ad763
comparison
equal deleted inserted replaced
1071:866be086cc9b 1072:2a3cfb98bd5e
1073 status = imstatus2char[budstate]; 1073 status = imstatus2char[budstate];
1074 } 1074 }
1075 1075
1076 // No status message for groups & MUC rooms 1076 // No status message for groups & MUC rooms
1077 if (!isgrp && !ismuc) { 1077 if (!isgrp && !ismuc) {
1078 GSList *resources = buddy_getresources(BUDDATA(current_buddy)); 1078 GSList *resources, *p_res;
1079 resources = buddy_getresources(BUDDATA(current_buddy));
1079 msg = buddy_getstatusmsg(BUDDATA(current_buddy), 1080 msg = buddy_getstatusmsg(BUDDATA(current_buddy),
1080 resources ? resources->data : ""); 1081 resources ? resources->data : "");
1082 // Free the resources list data
1083 for (p_res = resources ; p_res ; p_res = g_slist_next(p_res))
1084 g_free(p_res->data);
1085 g_slist_free(resources);
1081 } else if (ismuc) { 1086 } else if (ismuc) {
1082 msg = buddy_gettopic(BUDDATA(current_buddy)); 1087 msg = buddy_gettopic(BUDDATA(current_buddy));
1083 } 1088 }
1084 if (!msg) 1089 if (!msg)
1085 msg = ""; 1090 msg = "";
1198 rOffset = offset; 1203 rOffset = offset;
1199 1204
1200 for (i=0; i<maxy && buddy; buddy = g_list_next(buddy)) { 1205 for (i=0; i<maxy && buddy; buddy = g_list_next(buddy)) {
1201 unsigned short bflags, btype, ismsg, isgrp, ismuc, ishid, isspe; 1206 unsigned short bflags, btype, ismsg, isgrp, ismuc, ishid, isspe;
1202 gchar *rline_locale; 1207 gchar *rline_locale;
1203 GSList *resources; 1208 GSList *resources, *p_res;
1204 1209
1205 bflags = buddy_getflags(BUDDATA(buddy)); 1210 bflags = buddy_getflags(BUDDATA(buddy));
1206 btype = buddy_gettype(BUDDATA(buddy)); 1211 btype = buddy_gettype(BUDDATA(buddy));
1207 1212
1208 ismsg = bflags & ROSTER_FLAG_MSG; 1213 ismsg = bflags & ROSTER_FLAG_MSG;
1218 1223
1219 status = '?'; 1224 status = '?';
1220 pending = ' '; 1225 pending = ' ';
1221 1226
1222 resources = buddy_getresources(BUDDATA(buddy)); 1227 resources = buddy_getresources(BUDDATA(buddy));
1223 for ( ; resources ; resources = g_slist_next(resources) ) { 1228 for (p_res = resources ; p_res ; p_res = g_slist_next(p_res)) {
1224 guint events = buddy_resource_getevents(BUDDATA(buddy), 1229 guint events = buddy_resource_getevents(BUDDATA(buddy),
1225 resources ? resources->data : ""); 1230 p_res ? p_res->data : "");
1226 if (events & ROSTER_EVENT_PAUSED) 1231 if ((events & ROSTER_EVENT_PAUSED) && pending != '+')
1227 pending = '.'; 1232 pending = '.';
1228 if (events & ROSTER_EVENT_COMPOSING) { 1233 if (events & ROSTER_EVENT_COMPOSING)
1229 pending = '+'; 1234 pending = '+';
1230 break; 1235 g_free(p_res->data);
1231 } 1236 }
1232 } 1237 g_slist_free(resources);
1233 1238
1234 // Display message notice if there is a message flag, but not 1239 // Display message notice if there is a message flag, but not
1235 // for unfolded groups. 1240 // for unfolded groups.
1236 if (ismsg && (!isgrp || ishid)) { 1241 if (ismsg && (!isgrp || ishid)) {
1237 pending = '#'; 1242 pending = '#';