Changeset: 1f69d764822d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1f69d764822d
Modified Files:
        sql/storage/store.c
Branch: Jun2020
Log Message:

cleanup leak fix.


diffs (113 lines):

diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -170,6 +170,31 @@ table_destroy(sql_table *t)
                store_funcs.destroy_del(NULL, t);
 }
 
+static void
+table_cleanup(sql_table *t)
+{
+       if (t->keys.dset) {
+               list_destroy(t->keys.dset);
+               t->keys.dset = NULL;
+       }
+       if (t->idxs.dset) {
+               list_destroy(t->idxs.dset);
+               t->idxs.dset = NULL;
+       }
+       if (t->triggers.dset) {
+               list_destroy(t->triggers.dset);
+               t->triggers.dset = NULL;
+       }
+       if (t->columns.dset) {
+               list_destroy(t->columns.dset);
+               t->columns.dset = NULL;
+       }
+       if (t->members.dset) {
+               list_destroy(t->members.dset);
+               t->members.dset = NULL;
+       }
+}
+
 void
 schema_destroy(sql_schema *s)
 {
@@ -185,6 +210,26 @@ schema_destroy(sql_schema *s)
 }
 
 static void
+schema_cleanup(sql_schema *s)
+{
+       if (s->tables.set)
+               for (node *n = s->tables.set->h; n; n = n->next)
+                       table_cleanup(n->data);
+       if (s->tables.dset) {
+               list_destroy(s->tables.dset);
+               s->tables.dset = NULL;
+       }
+       if (s->funcs.dset) {
+               list_destroy(s->funcs.dset);
+               s->funcs.dset = NULL;
+       }
+       if (s->types.dset) {
+               list_destroy(s->types.dset);
+               s->types.dset = NULL;
+       }
+}
+
+static void
 trans_drop_tmp(sql_trans *tr) 
 {
        sql_schema *tmp;
@@ -234,6 +279,17 @@ sql_trans_destroy(sql_trans *t, bool try
 }
 
 static void
+trans_cleanup(sql_trans *t)
+{
+       for (node *m = t->schemas.set->h; m; m = m->next)
+               schema_cleanup(m->data);
+       if (t->schemas.dset) {
+               list_destroy(t->schemas.dset);
+               t->schemas.dset = NULL;
+       }
+}
+
+static void
 destroy_spare_transactions(void) 
 {
        int i, s = spares;
@@ -2200,31 +2256,7 @@ store_apply_deltas(bool not_locked)
        /* make sure we reset all transactions on re-activation */
        gtrans->wstime = timestamp();
        /* cleanup drop tables, columns and idxs first */
-       for (node *m = gtrans->schemas.set->h; m; m = m->next) { 
-               sql_schema *s = m->data;
-
-               if (s->tables.set)
-               for (node *n = s->tables.set->h; n; n = n->next) { 
-                       sql_table *t = n->data; 
-
-                       if (t->columns.dset) {
-                               list_destroy(t->columns.dset);
-                               t->columns.dset = NULL;
-                       }
-                       if (t->idxs.dset) {
-                               list_destroy(t->idxs.dset);
-                               t->idxs.dset = NULL;
-                       }
-               }
-               if (s->tables.dset) {
-                       list_destroy(s->tables.dset);
-                       s->tables.dset = NULL;
-               }
-       }
-       if (gtrans->schemas.dset) {
-               list_destroy(gtrans->schemas.dset);
-               gtrans->schemas.dset = NULL;
-       }
+       trans_cleanup(gtrans);
 
        if (store_funcs.gtrans_update)
                store_funcs.gtrans_update(gtrans);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to