dtfile/sharedFuncs: CID 88085; resource leak
authorJon Trulson <jon@radscan.com>
Thu, 5 Apr 2018 19:28:04 +0000 (13:28 -0600)
committerJon Trulson <jon@radscan.com>
Thu, 5 Apr 2018 19:28:04 +0000 (13:28 -0600)
cde/programs/dtfile/dtcopy/sharedFuncs.c

index efeca3bbf03897845f21679a34448d299b495fc6..3d5b0c4af2e52e8373d572b246fd34d17d8259fb 100644 (file)
@@ -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;
     }