mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
WUtil: Fix non-closed file handle in WMWritePropListToFile
As reported by Coverity (CID #50129), in case of error during the write operation, the failure path does include close of the file handle. In addition to the resource leak, this may be a problem if the application were to make a second try on the same file. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
7c50721747
commit
6ebec0bb9f
@@ -1695,6 +1695,7 @@ Bool WMWritePropListToFile(WMPropList * plist, const char *path)
|
|||||||
if (fprintf(theFile, "%s\n", desc) != strlen(desc) + 1) {
|
if (fprintf(theFile, "%s\n", desc) != strlen(desc) + 1) {
|
||||||
werror(_("writing to file: %s failed"), thePath);
|
werror(_("writing to file: %s failed"), thePath);
|
||||||
wfree(desc);
|
wfree(desc);
|
||||||
|
fclose(theFile);
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user