1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-23 14:42:29 +01:00

WMaker: change conceptually imperfect code in drawerDestroy (Coverity #50265)

Factually, the program works because the function 'drawerRemoveFromChain'
uses only the address of the drawer and not the content of the structure,
but conceptually this address point to a storage space that has been
de-allocated, so that's calling for trouble for future code changes.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-05-20 21:46:50 +02:00
committed by Carlos R. Mafra
parent 68e4ccca58
commit 1a64ca8275

View File

@@ -4448,13 +4448,15 @@ static void drawerDestroy(WDock *drawer)
wAppIconDestroy(drawer->icon_array[0]); wAppIconDestroy(drawer->icon_array[0]);
wfree(drawer->icon_array); wfree(drawer->icon_array);
wfree(drawer); drawer->icon_array = NULL;
drawerRemoveFromChain(scr, drawer); drawerRemoveFromChain(scr, drawer);
if (scr->last_dock == drawer) if (scr->last_dock == drawer)
scr->last_dock = NULL; scr->last_dock = NULL;
if (scr->attracting_drawer == drawer) if (scr->attracting_drawer == drawer)
scr->attracting_drawer = NULL; scr->attracting_drawer = NULL;
wfree(drawer);
} }