Changeset: 6f4ba0610571 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6f4ba0610571
Modified Files:
monetdb5/mal/mal_scenario.c
sql/backends/monet5/sql_execute.c
sql/backends/monet5/sql_scenario.c
sql/backends/monet5/wlr.c
Branch: Jan2022
Log Message:
Free unused exceptions on corner cases
diffs (114 lines):
diff --git a/monetdb5/mal/mal_scenario.c b/monetdb5/mal/mal_scenario.c
--- a/monetdb5/mal/mal_scenario.c
+++ b/monetdb5/mal/mal_scenario.c
@@ -391,8 +391,10 @@ resetScenario(Client c)
return;
scen = findScenario(c->scenario);
- if (scen != NULL && scen->exitClientCmd)
- (*scen->exitClientCmd) (c);
+ if (scen != NULL && scen->exitClientCmd) {
+ str msg = (*scen->exitClientCmd) (c);
+ freeException(msg);
+ }
c->scenario = c->oldscenario;
for (i = 0; i < SCENARIO_PROPERTIES; i++) {
diff --git a/sql/backends/monet5/sql_execute.c
b/sql/backends/monet5/sql_execute.c
--- a/sql/backends/monet5/sql_execute.c
+++ b/sql/backends/monet5/sql_execute.c
@@ -338,8 +338,10 @@ SQLstatementIntern(Client c, const char
ac = m->session->auto_commit;
o = MNEW(mvc);
if (!o) {
- if (inited)
- SQLresetClient(c);
+ if (inited) {
+ msg = SQLresetClient(c);
+ freeException(msg);
+ }
throw(SQL, "sql.statement", SQLSTATE(HY013) MAL_MALLOC_FAIL);
}
*o = *m;
@@ -646,8 +648,10 @@ endofcompile:
m->frames = frames;
m->session->status = status;
m->session->auto_commit = ac;
- if (inited)
- SQLresetClient(c);
+ if (inited) {
+ str other = SQLresetClient(c);
+ freeException(other);
+ }
return msg;
}
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
@@ -191,15 +191,15 @@ SQLexit(Client c)
str
SQLepilogue(void *ret)
{
- char *s = "sql", *m = "msql";
- str res;
+ char *s = "sql", *m = "msql", *msg;
(void) ret;
- (void) SQLexit(NULL);
+ msg = SQLexit(NULL);
+ freeException(msg);
/* this function is never called, but for the style of it, we clean
* up our own mess */
if (!GDKinmemory(0) && !GDKembedded()) {
- res = msab_retreatScenario(m);
+ str res = msab_retreatScenario(m);
if (!res)
res = msab_retreatScenario(s);
if (res != NULL) {
diff --git a/sql/backends/monet5/wlr.c b/sql/backends/monet5/wlr.c
--- a/sql/backends/monet5/wlr.c
+++ b/sql/backends/monet5/wlr.c
@@ -211,13 +211,11 @@ WLRprocessBatch(Client cntxt)
size_t sz;
MalBlkPtr mb;
InstrPtr q;
- str other;
mvc *sql;
Symbol prev = NULL;
lng tag;
char tag_read[26]; // stop re-processing
transactions when time limit is reached
- str action= NULL;
- str msg= MAL_SUCCEED, msg2= MAL_SUCCEED;
+ str action= NULL, msg= MAL_SUCCEED, msg2= MAL_SUCCEED, other;
msg = WLRgetConfig();
tag = wlr_tag;
@@ -260,13 +258,15 @@ WLRprocessBatch(Client cntxt)
return msg;
}
if ((msg = getSQLContext(c, mb, &sql, NULL))) {
- SQLexitClient(c);
+ other = SQLexitClient(c);
+ freeException(other);
MCcloseClient(c);
freeSymbol(prev);
return msg;
}
if ((msg = checkSQLContext(c)) != NULL) {
- SQLexitClient(c);
+ other = SQLexitClient(c);
+ freeException(other);
MCcloseClient(c);
freeSymbol(prev);
return msg;
@@ -423,7 +423,8 @@ WLRprocessBatch(Client cntxt)
}
close_stream(c->fdout);
- SQLexitClient(c);
+ other = SQLexitClient(c);
+ freeException(other);
MCcloseClient(c);
if (prev)
freeSymbol(prev);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list