[742] in NetBSD-Development
Fixed vtwm.gamma bug triggered by vat
daemon@ATHENA.MIT.EDU (ghudson@MIT.EDU)
Sat Apr 29 23:58:01 1995
From: ghudson@MIT.EDU
Date: Sat, 29 Apr 95 23:57:42 -0400
To: windowmgr@MIT.EDU
Cc: netbsd-dev@MIT.EDU
Using Purify, I discovered that vtwm.gamma double-frees memory when
you run vat. The bug (which also exists in twm) causes vtwm.gamma to
crash under NetBSD when you run vat. The bug has to do with
add_window.c aliasing ->icon_name to ->name. I modified add_window.c
and events.c to always strdup() the values of ->icon_name, ->fullname,
and ->name (XFree()ing anything that came from an Xlib call), and I
also modified free_window_names() to free values using free() instead
of XFree(), and not to check for NoName(). This seemed like the
easiest way to ensure that memory was never double-freed (because
there's no aliasing) and to ensure that the correct free routine was
always used for memory.
Marc: I also fixed a minor uninitialized memory problem in
icon_manager.c where a largely uninitialized window manager hints
structure gets passed to XSetWMHints. I just initialized the
structure to 0 using an " = {}" initializer. I didn't feel like
breaking your lock, so I just edited your locked copy of the file.