From 4b9bcae29f3bbf6623cd9b3416c973930efeaedf Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Sun, 1 Apr 2018 18:41:11 -0600 Subject: [PATCH] dtcreate/fileio.c: coverity CID 175094; dref bef NULL --- cde/programs/dtcreate/fileio.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cde/programs/dtcreate/fileio.c b/cde/programs/dtcreate/fileio.c index ba1a0b3e..f4d27d82 100644 --- a/cde/programs/dtcreate/fileio.c +++ b/cde/programs/dtcreate/fileio.c @@ -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); } -- 2.25.1