dtcreate/fileio.c: coverity CID 175094; dref bef NULL
authorJon Trulson <jon@radscan.com>
Mon, 2 Apr 2018 00:41:11 +0000 (18:41 -0600)
committerJon Trulson <jon@radscan.com>
Mon, 2 Apr 2018 00:41:54 +0000 (18:41 -0600)
cde/programs/dtcreate/fileio.c

index ba1a0b3e679a7799041ccb311e5c7a30c46b9c77..f4d27d82254b090d907548298f4b0bc5d2b37b55 100644 (file)
@@ -412,6 +412,9 @@ ushort WriteDefinitionFile(char *pszFile, ActionData *pAD)
   char            *ptr;
   char            *msgPtr, *fmtPtr, *errPtr;
 
+  if (!pszFile)
+      return 1;
+
   /***************************************************************************/
   /* Open action and filetypes definition file for writing.                  */
   /***************************************************************************/
@@ -613,10 +616,11 @@ ushort WriteDefinitionFile(char *pszFile, ActionData *pAD)
     }
   }
   SetCookie(fp);
-  if (fp) fclose(fp);
-  if(pszFile) {
-    chmod(pszFile, 0644);
-  }
+  if (fp)
+      fclose(fp);
+
+  chmod(pszFile, 0644);
+
   return(0);
 }