mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-18 20:10:29 +01:00
Fix use-after-free error in wIconStore reported by Coverity
The function always returns the filename where the icon have been saved, but in the case where the save operation failed we would free the memory for that file name, yet still return this pointer like if it were valid. Took opportunity to remove redundant free(path) which is done a couple lines later, because redundancy is a source of problem for code maintenance. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
97a9300aa4
commit
e828e1c074
@@ -518,9 +518,8 @@ char *wIconStore(WIcon *icon)
|
||||
}
|
||||
|
||||
if (!RSaveImage(image, path, "XPM")) {
|
||||
wfree(path);
|
||||
wfree(filename);
|
||||
path = NULL;
|
||||
filename = NULL;
|
||||
}
|
||||
|
||||
wfree(path);
|
||||
|
||||
Reference in New Issue
Block a user