[Openvas-commits] r6100 - in trunk/openvas-client: . openvas

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Dec 9 01:55:25 CET 2009


Author: timb
Date: 2009-12-09 01:55:24 +0100 (Wed, 09 Dec 2009)
New Revision: 6100

Modified:
   trunk/openvas-client/ChangeLog
   trunk/openvas-client/openvas/read_target_file.c
Log:
Fixed potential resource leak


Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog	2009-12-09 00:34:32 UTC (rev 6099)
+++ trunk/openvas-client/ChangeLog	2009-12-09 00:55:24 UTC (rev 6100)
@@ -1,3 +1,7 @@
+2009-12-09  Tim Brown <timb at openvas.org>
+
+	* openvas/read_target_file.c: Fixed potential resource leak.
+
 2009-12-07  Michael Wiegand <michael.wiegand at intevation.de>
 
 	Post-release version bump.

Modified: trunk/openvas-client/openvas/read_target_file.c
===================================================================
--- trunk/openvas-client/openvas/read_target_file.c	2009-12-09 00:34:32 UTC (rev 6099)
+++ trunk/openvas-client/openvas/read_target_file.c	2009-12-09 00:55:24 UTC (rev 6100)
@@ -165,6 +165,7 @@
 
  if (lstat (filename, &sb) != 0) {
    show_error(_("Cannot stat %s (%s)\n"), filename, strerror(errno));
+   close(fd);
    return 0;
  }
  len = (int)sb.st_size;
@@ -179,11 +180,11 @@
        show_error(_("file mapping failed: unexpected end-of-file\n"));
      else  
        show_error(_("file mapping failed: %s\n"), strerror(errno));
+     close(fd);
      return 0;
    }
  } while (offs += n, (left -= n) > 0) ;
 
-
  t = ret;
  while((t=strchr(t, '\n')))t[0]=',';
  t = ret;
@@ -203,6 +204,7 @@
   // Strip out the virtual hosts.
   result = translate_vhosts (ret);
 
+ close(fd);
   efree (&ret);
   return (result);
 }



More information about the Openvas-commits mailing list