Plug some (possible) memleaks
commitdce16306bc697874590208af232db8c6c72ca31a
authorTamas TEVESZ <ice@extreme.hu>
Mon, 18 Apr 2011 18:39:06 +0000 (18 20:39 +0200)
committerCarlos R. Mafra <crmafra@gmail.com>
Mon, 18 Apr 2011 20:25:44 +0000 (18 13:25 -0700)
tree769c7ada8caca1f6f201f9fc12fd590c0ae35c37
parentf6fefbd9b6c6d22b13a22a22955478395933e615
Plug some (possible) memleaks

PropGetWMClass()

- XAllocClassHint()s a struct for class hint data
- This is filled by XGetClassHint(), which in turn uses Xlib to allocate
  some more space for XClassHint members
- Upon XGetClassHint() failure, "default" is libc malloc'd (via strdup),
  and is returned to the caller
- Upon XGetClassHint() success, XClassHint members are returned raw --
  these members must be freed with XFree() (see XAllocClassHint(3))
- Thus it's up to PropGetWMClass() callers to decide (based upon the return
  value) which method (libc free() or XFree()) to use to free res_name
  and res_class. This was done nowhere, thus leaking some memory
  on every failed PropGetWMClass() call.
- So just strdup the successful res_name/res_class members, XFree() them
  while still in PropGetWMClass(), and allow callers to unconditionally
  libc free() whatever PropGetWMClass() returns.
src/dock.c
src/properties.c
src/session.c
src/window.c