OSSP CVS Repository

ossp - Difference in ossp-pkg/val/val.c versions 1.6 and 1.7
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/val/val.c 1.6 -> 1.7

--- val.c        2002/01/17 12:19:09     1.6
+++ val.c        2002/01/18 18:12:33     1.7
@@ -516,7 +516,7 @@
 /* destroy the whole hash table */
 static int lh_destroy(lh_t *h)
 {
-    element_t *el, **pel;
+    element_t *el, **pel, *el_next;
     unsigned int i, j;
 
     /* argument consistency check */
@@ -533,10 +533,13 @@
                 continue;
             /* deallocate all elements in collision chain */
             pel = &h->h_dir[i]->s_element[j];
-            for (el = *pel; el != NULL; el = el->e_next) {
+            for (el = *pel; el != NULL; ) {
                 /* deallocate key+data memory chunk */
                 if (el->e_keyptr != NULL)
                     free(el->e_keyptr);
+                el_next = el->e_next;
+                free(el);
+                el = el_next;
             }
         }
         free(h->h_dir[i]);

CVSTrac 2.0.1