>From 08bf797835c8f7dede310978a24920de4a363cb4 Mon Sep 17 00:00:00 2001
From: Tobias Stoeckmann <[email protected]>
Date: Thu, 3 May 2012 17:48:56 +0200
Subject: [PATCH] Fixed memory leak in wHideAll.

---
 src/actions.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/actions.c b/src/actions.c
index e0339c4..e730570 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1227,13 +1227,13 @@ void wHideAll(WScreen *scr)
 
        menu = scr->switch_menu;
 
-       windows = malloc(sizeof(WWindow *));
+       windows = wmalloc(sizeof(WWindow *));
 
        if (menu != NULL) {
                for (i = 0; i < menu->entry_no; i++) {
                        windows[wcount] = (WWindow *) 
menu->entries[i]->clientdata;
                        wcount++;
-                       windows = realloc(windows, sizeof(WWindow *) * 
(wcount+1));
+                       windows = wrealloc(windows, sizeof(WWindow *) * (wcount 
+ 1));
                }
        } else {
                wwin = scr->focused_window;
@@ -1241,7 +1241,7 @@ void wHideAll(WScreen *scr)
                while (wwin) {
                        windows[wcount] = wwin;
                        wcount++;
-                       windows = realloc(windows, sizeof(WWindow *) * 
(wcount+1));
+                       windows = wrealloc(windows, sizeof(WWindow *) * (wcount 
+ 1));
                        wwin = wwin->prev;
 
                }
@@ -1258,6 +1258,8 @@ void wHideAll(WScreen *scr)
                        wIconifyWindow(wwin);
                }
        }
+
+       wfree(windows);
 }
 
 void wHideOtherApplications(WWindow *awin)
-- 
1.7.6


-- 
To unsubscribe, send mail to [email protected].

Reply via email to