From: Jon Trulson Date: Thu, 5 Apr 2018 19:28:04 +0000 (-0600) Subject: dtfile/sharedFuncs: CID 88085; resource leak X-Git-Tag: 2.2.4a~123 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=70f85d77cc753b7a110e90cea3ad448bf93a3930;p=oweals%2Fcde.git dtfile/sharedFuncs: CID 88085; resource leak --- diff --git a/cde/programs/dtfile/dtcopy/sharedFuncs.c b/cde/programs/dtfile/dtcopy/sharedFuncs.c index efeca3bb..3d5b0c4a 100644 --- a/cde/programs/dtfile/dtcopy/sharedFuncs.c +++ b/cde/programs/dtfile/dtcopy/sharedFuncs.c @@ -481,9 +481,11 @@ CopyCheckDeletePermission( #endif { char *tmpfile; - tmpfile = tempnam(parentdir,"quang"); - if (creat(tmpfile,O_RDONLY)< 0) /* Create a temporary file */ + int rv; + tmpfile = tempnam(parentdir,"dtfile"); + if ( (rv = creat(tmpfile,O_RDONLY)) < 0) /* Create a temporary file */ return -1; + close(rv); if (remove(tmpfile) < 0) /* Delete the created file */ return -1; }