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:
committed by
Carlos R. Mafra
parent
9f2f94a174
commit
7d48855077
@@ -472,8 +472,6 @@ void wWorkspaceRelativeChange(WScreen * scr, int amount)
|
|||||||
void wWorkspaceForceChange(WScreen * scr, int workspace)
|
void wWorkspaceForceChange(WScreen * scr, int workspace)
|
||||||
{
|
{
|
||||||
WWindow *tmp, *foc = NULL, *foc2 = NULL;
|
WWindow *tmp, *foc = NULL, *foc2 = NULL;
|
||||||
WWindow **toUnmap;
|
|
||||||
int toUnmapSize, toUnmapCount;
|
|
||||||
|
|
||||||
if (workspace >= MAX_WORKSPACES || workspace < 0)
|
if (workspace >= MAX_WORKSPACES || workspace < 0)
|
||||||
return;
|
return;
|
||||||
@@ -492,16 +490,19 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
|
|||||||
|
|
||||||
wWorkspaceMenuUpdate(w_global.clip.ws_menu);
|
wWorkspaceMenuUpdate(w_global.clip.ws_menu);
|
||||||
|
|
||||||
toUnmapSize = 16;
|
|
||||||
toUnmapCount = 0;
|
|
||||||
toUnmap = wmalloc(toUnmapSize * sizeof(WWindow *));
|
|
||||||
|
|
||||||
if ((tmp = scr->focused_window) != NULL) {
|
if ((tmp = scr->focused_window) != NULL) {
|
||||||
|
WWindow **toUnmap;
|
||||||
|
int toUnmapSize, toUnmapCount;
|
||||||
|
|
||||||
if ((IS_OMNIPRESENT(tmp) && (tmp->flags.mapped || tmp->flags.shaded) &&
|
if ((IS_OMNIPRESENT(tmp) && (tmp->flags.mapped || tmp->flags.shaded) &&
|
||||||
!WFLAGP(tmp, no_focusable)) || tmp->flags.changing_workspace) {
|
!WFLAGP(tmp, no_focusable)) || tmp->flags.changing_workspace) {
|
||||||
foc = tmp;
|
foc = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toUnmapSize = 16;
|
||||||
|
toUnmapCount = 0;
|
||||||
|
toUnmap = wmalloc(toUnmapSize * sizeof(WWindow *));
|
||||||
|
|
||||||
/* foc2 = tmp; will fix annoyance with gnome panel
|
/* foc2 = tmp; will fix annoyance with gnome panel
|
||||||
* but will create annoyance for every other application
|
* but will create annoyance for every other application
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user