Re: [dwm] new windows on slave area

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Wed, 17 Jan 2007 11:07:05 +0100

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
Received on Wed Jan 17 2007 - 11:07:05 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:35:06 UTC