[cppcheck] found a resource leak in trunk/cups/monitor/tbcp.c

Ettl Martin ettl.martin at gmx.de
Sun Mar 14 07:03:39 PDT 2010


during a check of the current trunk with the static code analysis tool cppcheck (http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page), the tool discovered a resource leak in trunk/cups/monitor/tbcp.c

Please refert the attached patch that fixes the issue.

Best regards

Ettl Martin


Here is the patch:

Index: tbcp.c
===================================================================
--- tbcp.c	(Revision 9039)
+++ tbcp.c	(Arbeitskopie)
@@ -94,6 +94,7 @@
     if (psgets(line, &linelen, fp) == NULL)
     {
       fputs("ERROR: Empty print file!\n", stderr);
+      fclose(fp);
       return (1);
     }

@@ -145,7 +146,7 @@

     fflush(stdout);
   }
-
+  fclose(fp);
   return (0);
 }








More information about the cups mailing list