Mercurial > trustbridge
comparison cinst/main.c @ 339:5fa58979cb3a
Fix ressource leak found by cppcheck
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 09 Apr 2014 14:32:55 +0000 |
parents | c89bfb0e638e |
children | 124f08a85532 |
comparison
equal
deleted
inserted
replaced
338:64e38886f903 | 339:5fa58979cb3a |
---|---|
105 { | 105 { |
106 size_t len = strlen (buf); /* fgets ensures buf is terminated */ | 106 size_t len = strlen (buf); /* fgets ensures buf is terminated */ |
107 if (len <= 3) | 107 if (len <= 3) |
108 { | 108 { |
109 printf ("Line too short.\n"); | 109 printf ("Line too short.\n"); |
110 fclose (f); | |
110 return ERR_INVALID_INPUT; | 111 return ERR_INVALID_INPUT; |
111 } | 112 } |
112 if (lines_read++ > MAX_LINES) | 113 if (lines_read++ > MAX_LINES) |
113 { | 114 { |
114 printf ("Too many lines\n"); | 115 printf ("Too many lines\n"); |
116 fclose (f); | |
115 return ERR_TOO_MUCH_INPUT; | 117 return ERR_TOO_MUCH_INPUT; |
116 } | 118 } |
117 if (*buf == 'I') | 119 if (*buf == 'I') |
118 { | 120 { |
119 char *trimmed = buf+2; | 121 char *trimmed = buf+2; |
130 strv_append (to_remove, trimmed, strlen(trimmed)); | 132 strv_append (to_remove, trimmed, strlen(trimmed)); |
131 continue; | 133 continue; |
132 } | 134 } |
133 } | 135 } |
134 | 136 |
137 fclose (f); | |
135 return 0; | 138 return 0; |
136 } | 139 } |
137 | 140 |
138 /** @brief Check that the insturctions match to the list | 141 /** @brief Check that the insturctions match to the list |
139 * | 142 * |