Re: [wmii] snap: 20060329 -- shortcuts bug

From: Anselm R. Garbe <garbeam_AT_wmii.de>
Date: Thu, 30 Mar 2006 14:24:27 +0200

Stefan, many thanks, you found the bug and I claim to be a total
moron having done such stupid mistake. Though your solution is
not clean, because it attempts to detach non-attached keys (well
you might not have noticed this already):

On Thu, Mar 30, 2006 at 02:08:41PM +0200, Stefan Tibus wrote:
> So one bug is here:
> void
> destroy_key(Key *k)
> {
> cext_array_detach((void **)key, k, &keysz);
> nkey--;
> if(k->next)
> destroy_key(k->next);
> free(k);
> }
>
> I changed it to read:
> void
> destroy_key(Key *k)
> {
> cext_array_detach((void **)key, k, &keysz);
> if(k->next)
> destroy_key(k->next);
> else
> nkey--;
> free(k);
> }

void
destroy_key(Key *k)
{
        Key *n;
        cext_array_detach((void **)key, k, &keysz);
        nkey--;
        while(k) {
                n = k->next;
                free(k);
                k = n;
        }
}

Regards,

-- 
 Anselm R. Garbe  ><><  www.ebrag.de  ><><  GPG key: 0D73F361
Received on Thu Mar 30 2006 - 14:24:27 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:01:45 UTC