From 753f44c4b703b7451b7c79299bb80e074a51e534 Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Thu, 3 May 2012 17:48:56 +0200 Subject: [PATCH] Fixed memory leak in wHideAll. --- src/actions.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/actions.c b/src/actions.c index e0339c44..e7305703 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)