changeset 339:5fa58979cb3a

Fix ressource leak found by cppcheck
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 09 Apr 2014 14:32:55 +0000
parents 64e38886f903
children 9001eaa55549
files cinst/main.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/cinst/main.c	Wed Apr 09 14:26:53 2014 +0000
+++ b/cinst/main.c	Wed Apr 09 14:32:55 2014 +0000
@@ -107,11 +107,13 @@
       if (len <= 3)
         {
           printf ("Line too short.\n");
+          fclose (f);
           return ERR_INVALID_INPUT;
         }
       if (lines_read++ > MAX_LINES)
         {
           printf ("Too many lines\n");
+          fclose (f);
           return ERR_TOO_MUCH_INPUT;
         }
       if (*buf == 'I')
@@ -132,6 +134,7 @@
         }
     }
 
+  fclose (f);
   return 0;
 }
 

http://wald.intevation.org/projects/trustbridge/