From 0d3839a28a6bd45ab11b73d1b875dad2755ac454 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Mon, 19 Sep 2011 17:24:01 +0000 Subject: [PATCH] [REGTESTS2XML] Fix memory leaks svn path=/trunk/; revision=53762 --- reactos/tools/regtests2xml/regtests2xml.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/reactos/tools/regtests2xml/regtests2xml.c b/reactos/tools/regtests2xml/regtests2xml.c index 5759b50ea1d..3a079b302d4 100644 --- a/reactos/tools/regtests2xml/regtests2xml.c +++ b/reactos/tools/regtests2xml/regtests2xml.c @@ -81,7 +81,6 @@ convert_path(char* origpath) static void write_line(char *line) { - int n_out; char buf[200]; memset(buf, 0, sizeof(buf)); @@ -90,7 +89,7 @@ write_line(char *line) buf[strlen(buf)] = '\r'; buf[strlen(buf)] = '\n'; - n_out = fwrite(&buf[0], 1, strlen(buf), out); + (void)fwrite(&buf[0], 1, strlen(buf), out); } @@ -414,6 +413,7 @@ int main(int argc, char **argv) input_file = convert_path(argv[1]); if (input_file[0] == 0) { + free(input_file); printf("Missing input-filename\n"); return 1; } @@ -421,6 +421,8 @@ int main(int argc, char **argv) output_file = convert_path(argv[2]); if (output_file[0] == 0) { + free(output_file); + free(input_file); printf("Missing output-filename\n"); return 1; } @@ -428,6 +430,8 @@ int main(int argc, char **argv) out = fopen(output_file, "wb"); if (out == NULL) { + free(input_file); + free(output_file); printf("Cannot open output file"); return 1; } @@ -436,6 +440,8 @@ int main(int argc, char **argv) generate_xml(); + free(input_file); + free(output_file); fclose(out); return 0;