1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-22 14:08:06 +01:00

WMaker: fix memory leak in workspace switching (Coverity #50126)

As pointed by Coverity, if there's no window to unmap in a workspace, then
the array used to build the list of the windows to be unmapped for
workspace change would not be freed.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-05-20 21:46:37 +02:00
committed by Carlos R. Mafra
parent 9f2f94a174
commit 7d48855077

View File

@@ -472,8 +472,6 @@ void wWorkspaceRelativeChange(WScreen * scr, int amount)
void wWorkspaceForceChange(WScreen * scr, int workspace)
{
WWindow *tmp, *foc = NULL, *foc2 = NULL;
WWindow **toUnmap;
int toUnmapSize, toUnmapCount;
if (workspace >= MAX_WORKSPACES || workspace < 0)
return;
@@ -492,16 +490,19 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
wWorkspaceMenuUpdate(w_global.clip.ws_menu);
toUnmapSize = 16;
toUnmapCount = 0;
toUnmap = wmalloc(toUnmapSize * sizeof(WWindow *));
if ((tmp = scr->focused_window) != NULL) {
WWindow **toUnmap;
int toUnmapSize, toUnmapCount;
if ((IS_OMNIPRESENT(tmp) && (tmp->flags.mapped || tmp->flags.shaded) &&
!WFLAGP(tmp, no_focusable)) || tmp->flags.changing_workspace) {
foc = tmp;
}
toUnmapSize = 16;
toUnmapCount = 0;
toUnmap = wmalloc(toUnmapSize * sizeof(WWindow *));
/* foc2 = tmp; will fix annoyance with gnome panel
* but will create annoyance for every other application
*/