Changeset: 1e5b7a55c168 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1e5b7a55c168
Modified Files:
        sql/backends/monet5/sql_gencode.c
Branch: Jul2021
Log Message:

incase of failed allocation correctly cleanup and restore curprg


diffs (39 lines):

diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -872,7 +872,6 @@ backend_dumpproc(backend *be, Client c, 
        if (c->curprg == NULL) {
                sql_error(m, 001, SQLSTATE(HY013) MAL_MALLOC_FAIL);
                res = -1;
-               c->curprg = symbackup;
                goto cleanup;
        }
 
@@ -934,7 +933,7 @@ backend_dumpproc(backend *be, Client c, 
 
        // restore the context for the wrapper code
 cleanup:
-       if (res < 0) {
+       if (res < 0 && c->curprg) {
                if (!added_to_cache)
                        freeSymbol(c->curprg);
                else
@@ -1255,7 +1254,8 @@ backend_create_sql_func(backend *be, sql
        if (c->curprg == NULL) {
                sql_error(m, 001, SQLSTATE(HY013) MAL_MALLOC_FAIL);
                res = -1;
-               c->curprg = symbackup;
+               if (!vararg)
+                       f->sql--;
                goto cleanup;
        }
 
@@ -1375,7 +1375,7 @@ backend_create_sql_func(backend *be, sql
        }
 
 cleanup:
-       if (res < 0) {
+       if (res < 0 && c->curprg) {
                if (!vararg)
                        f->sql--;
                if (!added_to_cache)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to