[ros-diffs] [pschweitzer] 53763: [RGENSTAT] Fix memory leaks

pschweitzer at svn.reactos.org pschweitzer at svn.reactos.org
Mon Sep 19 17:24:28 UTC 2011


Author: pschweitzer
Date: Mon Sep 19 17:24:27 2011
New Revision: 53763

URL: http://svn.reactos.org/svn/reactos?rev=53763&view=rev
Log:
[RGENSTAT]
Fix memory leaks

Modified:
    trunk/reactos/tools/rgenstat/rgenstat.c

Modified: trunk/reactos/tools/rgenstat/rgenstat.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rgenstat/rgenstat.c?rev=53763&r1=53762&r2=53763&view=diff
==============================================================================
--- trunk/reactos/tools/rgenstat/rgenstat.c [iso-8859-1] (original)
+++ trunk/reactos/tools/rgenstat/rgenstat.c [iso-8859-1] Mon Sep 19 17:24:27 2011
@@ -113,7 +113,6 @@
 static void
 write_line(char *line)
 {
-  int n_out;
   char buf[200];
 
   memset(buf, 0, sizeof(buf));
@@ -122,7 +121,7 @@
   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);
 }
 
 
@@ -888,6 +887,7 @@
   input_file = convert_path(argv[1]);
   if (input_file[0] == 0)
     {
+      free(input_file);
       printf("Missing input-filename\n");
       return 1;
     }
@@ -895,6 +895,8 @@
   output_file = convert_path(argv[2]);
   if (output_file[0] == 0)
     {
+      free(input_file);
+      free(output_file);
       printf("Missing output-filename\n");
       return 1;
     }
@@ -902,12 +904,16 @@
   out = fopen(output_file, "wb");
   if (out == NULL)
     {
+      free(input_file);
+      free(output_file);
     	printf("Cannot open output file");
     	return 1;
      }
 
   read_input_file(input_file);
 
+  free(input_file);
+  free(output_file);
   fclose(out);
 
   return 0;




More information about the Ros-diffs mailing list