dtstyle: Coverity 87244
authorPeter Howkins <flibble@users.sf.net>
Tue, 3 Jul 2018 17:52:02 +0000 (18:52 +0100)
committerPeter Howkins <flibble@users.sf.net>
Tue, 3 Jul 2018 17:52:02 +0000 (18:52 +0100)
cde/programs/dtstyle/ColorFile.c

index 5c87e8cff42c929bedee791c1291d466f5a99a77..564ab16924fb7c4ee8fcd8851f894514bf83b0d0 100644 (file)
@@ -1112,7 +1112,7 @@ CheckFileType( void )
 {
    char *filename1 = "abcdefghijklmno";
    char *filename2 = "abcdefghijklmn";
-   int  fd, fd1;
+   int  fd = -1, fd1 = -1;
    char *tmpfile1, *tmpfile2;
  
   /* get the $HOME environment varible and constuct the full file name */
@@ -1162,7 +1162,9 @@ CheckFileType( void )
    XtFree(tmpfile1);
    XtFree(tmpfile2);
    close(fd);
-   close(fd1);
+   if(fd1 != -1) {
+      close(fd1);
+   }
    
 }