[cwm] Minor leak & truncation fixes, visual/colormap question
I'm using cwm as a daily driver on my Linux desktop machine and have
been maintaining a custom patchset for about half a year now. It mainly
removes features I never use, but also has seen one or two bug fixes.
In the hope that they are useful for upstream, I've attached a few of
them. Whilst based on my own tree of the cwm source, I've made sure that
these apply cleanly on top of the official xenocara tree with -p1.
PATCH 1/3) Fix string truncation in menu_draw
This one is pretty straightforward - the size calculation for dispstr
from menu.c did not account for the prompt characters, leading to
I think I've also identified a string truncation problem at menu.c:207
if (mi->text != '\0')
snprintf(mr->text, sizeof(mr->text), "%s \"%s\"",
As far as I can see, mr->text may end up being used for u_spawn,
possibly corrupting the quoted path if the string is truncated. I do not
have a fix ready for this as my patchset removes the path completion
PATCH 2/3) Plug memory leak in conf_clear
cargs and cargs->cmd were never freed in conf.c. My patch simply uses
the already existing conf_unbind_key() function to free those properly.
Lastly, PATCH 3/3 exists more as a request for comments and is not meant
for immediate inclusion. I am aware of a problem where certain windows'
borders (and the size or position popup menus) do not render correctly
when displayed with a compositor running.
I think this is because cwm uses the screen's default colormap and
visual to draw borders and popup menus, when it should be using each
window's colormap and visual instead. Borders and popup menus render
fine for me with the attached patch (more details there), but I am
unsure whether this is the correct solution.
I am very much not familiar with X11 programming and this patch is more
than 6 months old at this point, so I may just be doing the wrong thing
here. Nevertheless, maybe it's useful for further discussion.