Mercurial > pidgin.yaz
changeset 13453:efd3f93a220f
[gaim-migrate @ 15828]
Fix CIDs 33, 34 & 35 (NULL dereferencing), 60 (fd leak) and 61 (memleak)
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Tue, 07 Mar 2006 14:43:00 +0000 |
parents | fd606401a8d2 |
children | 1b5bf4b215f0 |
files | src/protocols/zephyr/zephyr.c |
diffstat | 1 files changed, 35 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/zephyr/zephyr.c Tue Mar 07 14:10:52 2006 +0000 +++ b/src/protocols/zephyr/zephyr.c Tue Mar 07 14:43:00 2006 +0000 @@ -254,23 +254,38 @@ static gboolean triple_subset(zephyr_triple * zt1, zephyr_triple * zt2) { - if (!zt2) + if (!zt2) { gaim_debug_error("zephyr","zt2 doesn't exist\n"); - if (!zt1) + return FALSE; + } + if (!zt1) { gaim_debug_error("zephyr","zt1 doesn't exist\n"); - if (!(zt1->class)) + return FALSE; + } + if (!(zt1->class)) { gaim_debug_error("zephyr","zt1c doesn't exist\n"); - if (!(zt1->instance)) + return FALSE; + } + if (!(zt1->instance)) { gaim_debug_error("zephyr","zt1i doesn't exist\n"); - if (!(zt1->recipient)) + return FALSE; + } + if (!(zt1->recipient)) { gaim_debug_error("zephyr","zt1r doesn't exist\n"); - if (!(zt2->class)) + return FALSE; + } + if (!(zt2->class)) { gaim_debug_error("zephyr","zt2c doesn't exist\n"); - if (!(zt2->recipient)) + return FALSE; + } + if (!(zt2->recipient)) { gaim_debug_error("zephyr","zt2r doesn't exist\n"); - if (!(zt2->instance)) + return FALSE; + } + if (!(zt2->instance)) { gaim_debug_error("zephyr","zt2i doesn't exist\n"); - + return FALSE; + } if (g_ascii_strcasecmp(zt2->class, zt1->class)) { return FALSE; @@ -732,9 +747,9 @@ g_string_free(str, TRUE); } else { if (nlocs>0) - gaim_prpl_got_user_status(gc->account,b->name,"available",NULL); + gaim_prpl_got_user_status(gc->account, b ? b->name : user, "available", NULL); else - gaim_prpl_got_user_status(gc->account,b->name,"offline",NULL); + gaim_prpl_got_user_status(gc->account, b ? b->name : user, "offline", NULL); } g_free(user); @@ -917,11 +932,13 @@ static parse_tree *find_node(parse_tree* ptree,gchar* key) { - gchar* tc = tree_child(ptree,0)->contents; + gchar* tc; if (!ptree || ! key) return &null_parse_tree; + tc = tree_child(ptree,0)->contents; + if (ptree->num_children > 0 && tc && !strcasecmp(tc, key)) { return ptree; } else { @@ -1148,9 +1165,9 @@ g_string_free(str, TRUE); } else { if (nlocs>0) - gaim_prpl_got_user_status(gc->account,b->name,"available",NULL); + gaim_prpl_got_user_status(gc->account, b ? b->name : user, "available", NULL); else - gaim_prpl_got_user_status(gc->account,b->name,"offline",NULL); + gaim_prpl_got_user_status(gc->account, b ? b->name : user, "offline", NULL); } } else if (!g_ascii_strncasecmp(spewtype,"subscribed",10)) { @@ -1459,6 +1476,7 @@ g_strfreev(triple); } } + fclose(f); } } @@ -1668,6 +1686,7 @@ } if (ptr >=bufcur) { gaim_connection_error(gc,"invalid output by tzc (or bad parsing code)"); + free(buf); return; } @@ -1758,8 +1777,9 @@ } if (parenlevel==0) break; - } /* while (ptr < bufcur) { */ + } /* while (ptr < bufcur) */ gaim_debug_info("zephyr", "tzc startup done\n"); + free(buf); } } else if ( use_zeph02(zephyr)) {