Re: [dwm] minor memory leak

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Wed, 6 Dec 2006 11:18:55 +0100

Hi nsz,

On Tue, Dec 05, 2006 at 08:34:01PM +0100, Szabolcs Nagy wrote:
> running dwm in valgrind i found the following leak:
>
> main.c(107) in setup: XFree(modmap->modifiermap) is needed

Well, the more correct way is:

XFreeModifiermap(modmap);

> valgrind also reports leak in XCreateFontCursor (main.c(96)) and
> apparently there is no XFreeCursor in cleanup(), but after i added
> XFreeCursor(dpy, cursor[CurNormal]);.. to cleanup() the leak is still
> there for some reason.

This might be because the order matters, the XFreeCursor calls
should be performed after the barwin is destroyed, otherwise
cursor[CurNormal] can't be freed, because still a resource
references it...

I pushed a fix which adds those things as I mentioned, would be
curios if valgrind still complains (however, I think those leaks
can be ignored since they are freed on exit() anyway.).

Regards,

-- 
 Anselm R. Garbe >< http://suckless.org/~arg/ >< GPG key: 0D73F361
Received on Wed Dec 06 2006 - 11:18:55 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:33:28 UTC