[Openvas-commits] r9250 - in trunk/openvas-libraries: . base

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Oct 21 18:22:09 CEST 2010


Author: mattm
Date: 2010-10-21 18:22:08 +0200 (Thu, 21 Oct 2010)
New Revision: 9250

Modified:
   trunk/openvas-libraries/ChangeLog
   trunk/openvas-libraries/base/array.c
Log:
	* base/array.c (array_free): Iterate using length, instead of depending
	on the caller to terminate the array.

Modified: trunk/openvas-libraries/ChangeLog
===================================================================
--- trunk/openvas-libraries/ChangeLog	2010-10-21 14:59:35 UTC (rev 9249)
+++ trunk/openvas-libraries/ChangeLog	2010-10-21 16:22:08 UTC (rev 9250)
@@ -1,3 +1,8 @@
+2010-10-21  Matthew Mundell <matthew.mundell at greenbone.net>
+
+	* base/array.c (array_free): Iterate using length, instead of depending
+	on the caller to terminate the array.
+
 2010-10-17  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
 
 	Move arglist-related functions into module arglists.

Modified: trunk/openvas-libraries/base/array.c
===================================================================
--- trunk/openvas-libraries/base/array.c	2010-10-21 14:59:35 UTC (rev 9249)
+++ trunk/openvas-libraries/base/array.c	2010-10-21 16:22:08 UTC (rev 9250)
@@ -65,10 +65,9 @@
 {
   if (array)
     {
-      int index = 0;
-      gpointer item;
-      while ((item = g_ptr_array_index (array, index++)))
-        g_free (item);
+      guint index = array->len;
+      while (index--)
+        g_free (g_ptr_array_index (array, index));
       g_ptr_array_free (array, TRUE);
     }
 }



More information about the Openvas-commits mailing list