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

_______________________________________________
[email protected] mailing list
http://wmii.de/cgi-bin/mailman/listinfo/wmii

Reply via email to