From 6ebec0bb9f6fa31a0e6e542b9fb306fd65c6afdc Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sun, 16 May 2021 15:47:04 +0200 Subject: [PATCH] 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 --- WINGs/proplist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/WINGs/proplist.c b/WINGs/proplist.c index 3203303d..54099991 100644 --- a/WINGs/proplist.c +++ b/WINGs/proplist.c @@ -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; } -- 2.11.4.GIT