1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

WMaker: fix memory leak in windows saved state handling (Coverity #50171)

As pointed by Coverity, the caller of the function 'getSavedState' assumes
that if the function returns 0 then the wstate is not initialised. This was
not actually true, so this patch changes 'getSavedState' to behave as
expected.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-05-20 21:46:44 +02:00
committed by Carlos R. Mafra
parent 4501d4c078
commit 32c8dc04ce

View File

@@ -2319,6 +2319,11 @@ static int getSavedState(Window window, WSavedState ** state)
(unsigned char **)&data) != Success || !data || nitems_ret < 10) (unsigned char **)&data) != Success || !data || nitems_ret < 10)
return 0; return 0;
if (type_ret != w_global.atom.wmaker.state) {
XFree(data);
return 0;
}
*state = wmalloc(sizeof(WSavedState)); *state = wmalloc(sizeof(WSavedState));
(*state)->workspace = data[0]; (*state)->workspace = data[0];
@@ -2334,10 +2339,7 @@ static int getSavedState(Window window, WSavedState ** state)
XFree(data); XFree(data);
if (*state && type_ret == w_global.atom.wmaker.state)
return 1; return 1;
else
return 0;
} }
#ifdef USE_XSHAPE #ifdef USE_XSHAPE