1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 20:10:29 +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:
Christophe CURIS
2021-05-16 15:47:04 +02:00
committed by Carlos R. Mafra
parent 7c50721747
commit 6ebec0bb9f

View File

@@ -1695,6 +1695,7 @@ Bool WMWritePropListToFile(WMPropList * plist, const char *path)
if (fprintf(theFile, "%s\n", desc) != strlen(desc) + 1) {
werror(_("writing to file: %s failed"), thePath);
wfree(desc);
fclose(theFile);
goto failure;
}