On Wed, Jan 17, 2007 at 01:00:51AM +0100, pancake wrote:
> +
> +     if (apwl) {
> +             Client *tc;
> +
> +             if(!clients)
> +                     stack = clients = c;
> +
> +             c->prev = clients;
> +             for(tc = clients; tc && tc->next; tc = tc->next)
> +                     c->prev = tc->next;
> +             tc->next  = tc->snext = c;

This seems dangerous if tc is NULL after the loop. There is a
missing if(tc) { ... }

if(apwl) {
        Client *tc;

        for(tc = clients; tc && tc->next; tc = tc->next);
        if(tc) {
                tc->next = c;
                c->prev = tc;
        }
        else
                clients = c;
}
else {
        if(clients)
                clients->prev = c;
        c->next = clients;
        clients = c;
}
c->snext = stack;
stack = c;

> +             c->next  = NULL;
> +             c->snext = NULL;

Those operations are not necessary, because c is allocated using
util.c:emallocz().

-- 
 Anselm R. Garbe >< http://suckless.org/~arg/ >< GPG key: 0D73F361

Reply via email to