From 2b7dd6c2a023186aefe12eaee7d33595379bf4c5 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 7 Dec 2010 17:01:58 -0500 Subject: Fixed some warnings found by cppcheck --- lang/langcomp.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lang/langcomp.c') diff --git a/lang/langcomp.c b/lang/langcomp.c index cdafefb4c..e221cf672 100644 --- a/lang/langcomp.c +++ b/lang/langcomp.c @@ -77,10 +77,12 @@ int read_index_file() numstrings++; if (!(stringnames = calloc(sizeof(char *), numstrings))) { perror("calloc(stringnames)"); + fclose(f); return -1; } if (!(strings = calloc(sizeof(char *), numstrings))) { perror("calloc(strings)"); + fclose(f); return -1; } fseek(f, 0, SEEK_SET); @@ -90,6 +92,7 @@ int read_index_file() buf[strlen(buf)-1] = '\0'; if (!(stringnames[i++] = anopeStrDup(buf))) { perror("strdup()"); + fclose(f); return -1; } } @@ -201,6 +204,7 @@ int main(int ac, char **av) } if (!(out = fopen(outfile, "wb"))) { perror(outfile); + fclose(in); return 1; } -- cgit