comparison mcabber/src/hooks.c @ 774:46304b773a44

Remove useless checks before g_free() calls
author Mikael Berthe <mikael@lilotux.net>
date Sat, 25 Mar 2006 18:16:10 +0100
parents 464be13343a9
children 4a6ce276ffca
comparison
equal deleted inserted replaced
773:e25b8a348ebd 774:46304b773a44
71 if (!roster_usr) { 71 if (!roster_usr) {
72 new_guy = TRUE; 72 new_guy = TRUE;
73 roster_usr = roster_add_user(jid, NULL, NULL, rtype, sub_none); 73 roster_usr = roster_add_user(jid, NULL, NULL, rtype, sub_none);
74 if (!roster_usr) { // Shouldn't happen... 74 if (!roster_usr) { // Shouldn't happen...
75 scr_LogPrint(LPRINT_LOGNORM, "ERROR: unable to add buddy!"); 75 scr_LogPrint(LPRINT_LOGNORM, "ERROR: unable to add buddy!");
76 if (bmsg) g_free(bmsg); 76 g_free(bmsg);
77 if (mmsg) g_free(mmsg); 77 g_free(mmsg);
78 return; 78 return;
79 } 79 }
80 } else if (is_groupchat) { 80 } else if (is_groupchat) {
81 // Make sure the type is ROOM 81 // Make sure the type is ROOM
82 buddy_settype(roster_usr->data, ROSTER_TYPE_ROOM); 82 buddy_settype(roster_usr->data, ROSTER_TYPE_ROOM);
145 { 145 {
146 buddylist_build(); 146 buddylist_build();
147 update_roster = TRUE; 147 update_roster = TRUE;
148 } 148 }
149 149
150 if (bmsg) g_free(bmsg); 150 g_free(bmsg);
151 if (mmsg) g_free(mmsg); 151 g_free(mmsg);
152 } 152 }
153 153
154 // hk_message_out() 154 // hk_message_out()
155 // nick should be set for private messages in a chat room, and null for 155 // nick should be set for private messages in a chat room, and null for
156 // normal messages. 156 // normal messages.
180 if (!nick) hlog_write_message(jid, timestamp, TRUE, msg); 180 if (!nick) hlog_write_message(jid, timestamp, TRUE, msg);
181 181
182 // External command 182 // External command
183 hk_ext_cmd(jid, 'M', 'S', NULL); 183 hk_ext_cmd(jid, 'M', 'S', NULL);
184 184
185 if (bmsg) g_free(bmsg); 185 g_free(bmsg);
186 if (mmsg) g_free(mmsg); 186 g_free(mmsg);
187 } 187 }
188 188
189 inline void hk_statuschange(const char *jid, const char *resname, gchar prio, 189 inline void hk_statuschange(const char *jid, const char *resname, gchar prio,
190 time_t timestamp, enum imstatus status, 190 time_t timestamp, enum imstatus status,
191 const char *status_msg) 191 const char *status_msg)
337 g_free(data_locale); 337 g_free(data_locale);
338 } 338 }
339 339
340 if ((pid=fork()) == -1) { 340 if ((pid=fork()) == -1) {
341 scr_LogPrint(LPRINT_LOGNORM, "Fork error, cannot launch external command."); 341 scr_LogPrint(LPRINT_LOGNORM, "Fork error, cannot launch external command.");
342 if (datafname) 342 g_free(datafname);
343 g_free(datafname);
344 return; 343 return;
345 } 344 }
346 345
347 if (pid == 0) { // child 346 if (pid == 0) { // child
348 // Close standard file descriptors 347 // Close standard file descriptors
352 if (execl(extcmd, extcmd, arg_type, arg_info, jid, arg_data, NULL) == -1) { 351 if (execl(extcmd, extcmd, arg_type, arg_info, jid, arg_data, NULL) == -1) {
353 // scr_LogPrint(LPRINT_LOGNORM, "Cannot execute external command."); 352 // scr_LogPrint(LPRINT_LOGNORM, "Cannot execute external command.");
354 exit(1); 353 exit(1);
355 } 354 }
356 } 355 }
357 if (datafname) 356 g_free(datafname);
358 g_free(datafname);
359 } 357 }
360 358
361 /* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */ 359 /* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */