Misc: Fix two memory leaks

- Fix two small memory leaks. valgrind detects another memory leak
  possibly caused by XGetTextProperty(), probably a bug in libX11, I
  couldn't fix that one.

- Use predefined atoms in Xatom.h to replace a few XInternAtom() calls.
pull/2/head
Richard Grenville 12 years ago
parent 80a4f6d0ab
commit 9a839bc661

@ -986,6 +986,7 @@ root_tile_f(Display *dpy) {
pixmap = None; pixmap = None;
for (p = 0; background_props[p]; p++) { for (p = 0; background_props[p]; p++) {
prop = NULL;
if (XGetWindowProperty(dpy, root, if (XGetWindowProperty(dpy, root,
XInternAtom(dpy, background_props[p], False), XInternAtom(dpy, background_props[p], False),
0, 4, False, AnyPropertyType, &actual_type, 0, 4, False, AnyPropertyType, &actual_type,
@ -997,7 +998,8 @@ root_tile_f(Display *dpy) {
XFree(prop); XFree(prop);
fill = False; fill = False;
break; break;
} } else if (prop)
XFree(prop);
} }
if (!pixmap) { if (!pixmap) {
@ -2178,6 +2180,9 @@ finish_destroy_win(Display *dpy, Window id) {
free_picture(dpy, &w->frame_alpha_pict); free_picture(dpy, &w->frame_alpha_pict);
free_picture(dpy, &w->shadow_pict); free_picture(dpy, &w->shadow_pict);
free_damage(dpy, &w->damage); free_damage(dpy, &w->damage);
free(w->name);
free(w->class_instance);
free(w->class_general);
free(w); free(w);
break; break;
@ -3005,10 +3010,10 @@ get_atoms(void) {
extents_atom = XInternAtom(dpy, "_NET_FRAME_EXTENTS", False); extents_atom = XInternAtom(dpy, "_NET_FRAME_EXTENTS", False);
opacity_atom = XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False); opacity_atom = XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False);
frame_extents_atom = XInternAtom(dpy, "_NET_FRAME_EXTENTS", False); frame_extents_atom = XInternAtom(dpy, "_NET_FRAME_EXTENTS", False);
client_atom = XInternAtom(dpy, "WM_CLASS", False); client_atom = XA_WM_CLASS;
name_atom = XInternAtom(dpy, "WM_NAME", False); name_atom = XA_WM_NAME;
name_ewmh_atom = XInternAtom(dpy, "_NET_WM_NAME", False); name_ewmh_atom = XInternAtom(dpy, "_NET_WM_NAME", False);
class_atom = XInternAtom(dpy, "WM_CLASS", False); class_atom = XA_WM_CLASS;
win_type_atom = XInternAtom(dpy, win_type_atom = XInternAtom(dpy,
"_NET_WM_WINDOW_TYPE", False); "_NET_WM_WINDOW_TYPE", False);

Loading…
Cancel
Save