Changeset: 5221b888fd29 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5221b888fd29
Modified Files:
        monetdb5/mal/mal_instruction.c
        monetdb5/mal/mal_parser.c
        monetdb5/optimizer/opt_garbageCollector.c
        sql/backends/monet5/sql_scenario.c
        sql/backends/monet5/sql_user.c
        sql/server/rel_schema.c
        sql/server/sql_mvc.c
Branch: Apr2019
Log Message:

Use freeException to free exceptions.


diffs (170 lines):

diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -27,7 +27,7 @@ addMalException(MalBlkPtr mb, str msg)
                        return ; // just stick to one error message, ignore rest
                strcpy(new, mb->errors);
                strcat(new, msg);
-               GDKfree(mb->errors);
+               freeException(mb->errors);
                mb->errors = new;
        } else {
                new = GDKstrdup(msg);
diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -1448,8 +1448,8 @@ parseEnd(Client cntxt)
                                strcat(new,"!");
                                strcat(new,cntxt->curprg->def->errors);
 
-                               GDKfree(errors);
-                               GDKfree(cntxt->curprg->def->errors);
+                               freeException(errors);
+                               freeException(cntxt->curprg->def->errors);
 
                                cntxt->curprg->def->errors=0;
                                errors = new;
diff --git a/monetdb5/optimizer/opt_garbageCollector.c 
b/monetdb5/optimizer/opt_garbageCollector.c
--- a/monetdb5/optimizer/opt_garbageCollector.c
+++ b/monetdb5/optimizer/opt_garbageCollector.c
@@ -144,7 +144,7 @@ OPTgarbageCollectorImplementation(Client
                chkFlow(mb);
                if ( mb->errors != MAL_SUCCEED ){
                        fprintf(stderr,"%s\n",mb->errors);
-                       GDKfree(mb->errors);
+                       freeException(mb->errors);
                        mb->errors = MAL_SUCCEED;
                }
                fprintFunction(stderr,mb, 0, LIST_MAL_ALL);
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -360,7 +360,7 @@ SQLresetClient(Client c)
        if(other && !msg)
                msg = other;
        else if(other && msg)
-               GDKfree(other);
+               freeException(other);
        return msg;
 }
 
@@ -553,7 +553,7 @@ SQLinit(Client c)
                                        m->sqs = NULL;
                                        if (newmsg){
                                                fprintf(stderr,"%s",newmsg);
-                                               GDKfree(newmsg);
+                                               freeException(newmsg);
                                        }
                                }
                        } while (p);
diff --git a/sql/backends/monet5/sql_user.c b/sql/backends/monet5/sql_user.c
--- a/sql/backends/monet5/sql_user.c
+++ b/sql/backends/monet5/sql_user.c
@@ -554,7 +554,7 @@ monet5_user_set_def_schema(mvc *m, oid u
        if (!schema || !mvc_set_schema(m, schema)) {
                if (m->session->active) {
                        if((other = mvc_rollback(m, 0, NULL, false)) != 
MAL_SUCCEED)
-                               GDKfree(other);
+                               freeException(other);
                }
                GDKfree(username);
                return NULL;
@@ -567,7 +567,7 @@ monet5_user_set_def_schema(mvc *m, oid u
        }
        GDKfree(username);
        if((other = mvc_rollback(m, 0, NULL, false)) != MAL_SUCCEED) {
-               GDKfree(other);
+               freeException(other);
                return NULL;
        }
        return schema;
diff --git a/sql/server/rel_schema.c b/sql/server/rel_schema.c
--- a/sql/server/rel_schema.c
+++ b/sql/server/rel_schema.c
@@ -1163,7 +1163,7 @@ rel_create_view(mvc *sql, sql_schema *ss
                                str output;
                                if((output = mvc_drop_table(sql, s, t, 0)) != 
MAL_SUCCEED) {
                                        sql_error(sql, 02, SQLSTATE(42000) 
"%s", output);
-                                       GDKfree(output);
+                                       freeException(output);
                                        return NULL;
                                }
                        }
diff --git a/sql/server/sql_mvc.c b/sql/server/sql_mvc.c
--- a/sql/server/sql_mvc.c
+++ b/sql/server/sql_mvc.c
@@ -44,14 +44,14 @@ sql_create_comments(mvc *m, sql_schema *
        sql_trans_alter_null(m->session->tr, c, 0);
 }
 
-#define MVC_INIT_DROP_TABLE(SQLID, TNAME)                      \
-       t = mvc_bind_table(m, s, TNAME);                           \
-       SQLID = t->base.id;                                        \
-       if((output = mvc_drop_table(m, s, t, 0)) != MAL_SUCCEED) { \
-               mvc_destroy(m);                                        \
-               fprintf(stderr, "!mvc_init: %s\n", output);            \
-               GDKfree(output);                                       \
-               return -1;                                             \
+#define MVC_INIT_DROP_TABLE(SQLID, TNAME)                              \
+       t = mvc_bind_table(m, s, TNAME);                                \
+       SQLID = t->base.id;                                             \
+       if((output = mvc_drop_table(m, s, t, 0)) != MAL_SUCCEED) {      \
+               mvc_destroy(m);                                         \
+               fprintf(stderr, "!mvc_init: %s\n", output);             \
+               freeException(output);                                  \
+               return -1;                                              \
        }
 
 int
@@ -383,7 +383,7 @@ mvc_commit(mvc *m, int chain, const char
        if (m->session->status < 0) {
                msg = createException(SQL, "sql.commit", SQLSTATE(40000) "%s 
transaction is aborted, will ROLLBACK instead", operation);
                if((other = mvc_rollback(m, chain, name, false)) != MAL_SUCCEED)
-                       GDKfree(other);
+                       freeException(other);
                return msg;
        }
 
@@ -398,14 +398,14 @@ mvc_commit(mvc *m, int chain, const char
                        store_unlock();
                        msg = createException(SQL, "sql.commit", 
SQLSTATE(HY001) "%s allocation failure while committing the transaction, will 
ROLLBACK instead", operation);
                        if((other = mvc_rollback(m, chain, name, false)) != 
MAL_SUCCEED)
-                               GDKfree(other);
+                               freeException(other);
                        return msg;
                }
                msg = WLCcommit(m->clientid);
                store_unlock();
                if(msg != MAL_SUCCEED) {
                        if((other = mvc_rollback(m, chain, name, false)) != 
MAL_SUCCEED)
-                               GDKfree(other);
+                               freeException(other);
                        return msg;
                }
                m->type = Q_TRANS;
@@ -446,7 +446,7 @@ build up the hash (not copied in the tra
                store_unlock();
                if(msg != MAL_SUCCEED) {
                        if((other = mvc_rollback(m, chain, name, false)) != 
MAL_SUCCEED)
-                               GDKfree(other);
+                               freeException(other);
                        return msg;
                }
                if (mvc_debug)
@@ -478,14 +478,14 @@ build up the hash (not copied in the tra
                store_unlock();
                msg = createException(SQL, "sql.commit", SQLSTATE(40000) "%s 
transaction is aborted because of concurrency conflicts, will ROLLBACK 
instead", operation);
                if((other = mvc_rollback(m, chain, name, false)) != MAL_SUCCEED)
-                       GDKfree(other);
+                       freeException(other);
                return msg;
        }
        msg = WLCcommit(m->clientid);
        if(msg != MAL_SUCCEED) {
                store_unlock();
                if((other = mvc_rollback(m, chain, name, false)) != MAL_SUCCEED)
-                       GDKfree(other);
+                       freeException(other);
                return msg;
        }
        sql_trans_end(m->session);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to