Changeset: f1dbd81e4041 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f1dbd81e4041
Modified Files:
        sql/common/sql_list.c
Branch: Jan2014
Log Message:

More aggressively set pointers to NULL after data has been destroyed.


diffs (38 lines):

diff --git a/sql/common/sql_list.c b/sql/common/sql_list.c
--- a/sql/common/sql_list.c
+++ b/sql/common/sql_list.c
@@ -96,8 +96,10 @@ list_empty(list *l)
 static void
 node_destroy(list *l, node *n)
 {
-       if (n->data && l->destroy)
+       if (n->data && l->destroy) {
                l->destroy(n->data);
+               n->data = NULL;
+       }
        if (!l->sa)
                _DELETE(n);
 }
@@ -106,14 +108,17 @@ void
 list_destroy(list *l)
 {
        if (l) {
-               node *n = l->h;
+               node **n = &l->h;
 
                MT_lock_destroy(&l->ht_lock);
-               while (n && (l->destroy|| !l->sa)) {
-                       node *t = n;
+               if (l->destroy || l->sa == NULL) {
+                       while (*n) {
+                               node *t = *n;
 
-                       n = n->next;
-                       node_destroy(l, t);
+                               *n = NULL;
+                               n = &t->next;
+                               node_destroy(l, t);
+                       }
                }
                if (!l->sa)
                        _DELETE(l);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to