From: Christophe CURIS <christophe.cu...@free.fr>

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.cu...@free.fr>
---
 src/window.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

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


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to