]> Pileus Git - wmpus/commitdiff
Fix memory management bugs
authorAndy Spencer <andy753421@gmail.com>
Thu, 6 Oct 2011 07:17:45 +0000 (07:17 +0000)
committerAndy Spencer <andy753421@gmail.com>
Thu, 6 Oct 2011 07:25:33 +0000 (07:25 +0000)
wm-wmii.c

index aab29217d453ee6de3dd5523db07a55fd80d2881..6618adb38b62695f9c969004491af74c51d53ce8 100644 (file)
--- a/wm-wmii.c
+++ b/wm-wmii.c
@@ -588,15 +588,14 @@ static void tag_switch(int name)
        printf("tag_switch: %d\n", name);
        tag_t *old = wm_tag;
        if ((wm_col == NULL || wm_row == NULL) && wm_flt == NULL) {
-               list_t *ltag = list_find(wm->tags, old);
-               wm->tags = list_remove(wm->tags, ltag, 1);
                while (old->dpys) {
                        dpy_t *dpy = old->dpys->data;
                        while (dpy->cols)
                                dpy->cols = list_remove(dpy->cols, dpy->cols, 1);
                        old->dpys = list_remove(old->dpys, old->dpys, 1);
                }
-               free(old);
+               list_t *ltag = list_find(wm->tags, old);
+               wm->tags = list_remove(wm->tags, ltag, 1);
        }
        wm_tag = tag_find(name);
 }