wmaker: fix memory leak in the Workspace Map if there is no workspace (Coverity ...
commit04404bf47c4eed536dde614333eb83b923b3ae59
authorChristophe CURIS <christophe.curis@free.fr>
Sat, 25 Apr 2015 10:44:24 +0000 (25 12:44 +0200)
committerCarlos R. Mafra <crmafra@gmail.com>
Sat, 25 Apr 2015 11:53:06 +0000 (25 07:53 -0400)
treedd864c789360b557d381ad9ef1a887ece3724610
parentae078991221b32367f98754e632021d3975827aa
wmaker: fix memory leak in the Workspace Map if there is no workspace (Coverity #109608)

As pointed by Coverity, there is a safety check on the number of workspace
which aborts the function, but the storage memory have already been
allocated so it would leak this buffer.

The case where the number of workspace is 0 is probably not supposed to
happen (there should always be at least 1 workspace, the current one), but
it is better to keep safety checks, so this patch is moving the check at
the beginning so no leak will occur.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
src/wsmap.c