[Openvas-commits] r6104 - trunk/sladinstaller

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Dec 9 03:18:50 CET 2009


Author: timb
Date: 2009-12-09 03:18:48 +0100 (Wed, 09 Dec 2009)
New Revision: 6104

Modified:
   trunk/sladinstaller/ChangeLog
   trunk/sladinstaller/tools.cpp
Log:
Fixed some memory leaks as reported by cppcheck


Modified: trunk/sladinstaller/ChangeLog
===================================================================
--- trunk/sladinstaller/ChangeLog	2009-12-09 02:10:20 UTC (rev 6103)
+++ trunk/sladinstaller/ChangeLog	2009-12-09 02:18:48 UTC (rev 6104)
@@ -1,3 +1,7 @@
+2009-12-09  Tim Brown <timb at openvas.org>
+
+	* tools.cpp: Fixed some memory leaks as reported by cppcheck.
+
 2009-07-16  Michael Wiegand <michael.wiegand at intevation.de>
 
 	* gtk.cpp: Updated PROG_WEBSITE to point to the new SLAD URL.

Modified: trunk/sladinstaller/tools.cpp
===================================================================
--- trunk/sladinstaller/tools.cpp	2009-12-09 02:10:20 UTC (rev 6103)
+++ trunk/sladinstaller/tools.cpp	2009-12-09 02:18:48 UTC (rev 6104)
@@ -108,9 +108,10 @@
     return 0;
 
   CURL *curl=curl_easy_init();
-  if(!curl)
+  if(!curl) {
     fclose(f);
     return 0;
+  }
 
   curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
   curl_easy_setopt(curl, CURLOPT_WRITEDATA, f); // see curl_easy_setopt(3) for issues with Win32 dll
@@ -213,8 +214,10 @@
   PROGRESS(_("downloading package from server"));
 
   CURL *curl=curl_easy_init();
-  if(!curl)
+  if(!curl) {
+    fclose(f);
     return std::string(SLAD_ERROR)+' '+_("could not init CURL library");
+  }
 
   curl_easy_setopt(curl, CURLOPT_URL, package.c_str());
   curl_easy_setopt(curl, CURLOPT_WRITEDATA, f); // see curl_easy_setopt(3) for issues with Win32 dll



More information about the Openvas-commits mailing list