]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
Fix coverity issue 1.
authorZdenek Dohnal <zdohnal@redhat.com>
Wed, 15 Feb 2023 17:37:37 +0000 (18:37 +0100)
committerZdenek Dohnal <zdohnal@redhat.com>
Wed, 15 Feb 2023 17:37:37 +0000 (18:37 +0100)
Close file descriptor in case of error

filter/foomatic-rip/foomaticrip.c

index b6abe4d33e02fca68d03bfc93e69b558345763f0..036d6138b798354866b5f7129500bae948c75f46 100644 (file)
@@ -639,7 +639,7 @@ int
 print_file(const char *filename,
           int convert)
 {
-  FILE *file;
+  FILE *file = NULL;
   char buf[8192];
   char tmpfilename[PATH_MAX] = "";
   int type;
@@ -664,6 +664,8 @@ print_file(const char *filename,
     n = fread_or_die(buf, 1, sizeof(buf) - 1, file);
     if (!n) {
       _log("Input is empty, outputting empty file.\n");
+      if (strcasecmp(filename, "<STDIN>"))
+        fclose(file);
       return (1);
     }
     buf[n] = '\0';