[tarantool-patches] [PATCH v1 2/2] sql: fixed possible leak in sqlite3EndTable
Kirill Shcherbatov
kshcherbatov at tarantool.org
Thu Jul 12 19:34:28 MSK 2018
---
src/box/sql/build.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index 946b10c..200f7e8 100644
--- a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -1762,7 +1762,7 @@ sqlite3EndTable(Parse * pParse, /* Parse context */
diag_set(ClientError, ER_SQL, err_str);
pParse->rc = SQL_TARANTOOL_ERROR;
pParse->nErr++;
- return;
+ goto cleanup;
}
}
@@ -1771,7 +1771,7 @@ sqlite3EndTable(Parse * pParse, /* Parse context */
sqlite3ErrorMsg(pParse,
"PRIMARY KEY missing on table %s",
p->def->name);
- return;
+ goto cleanup;
} else {
convertToWithoutRowidTable(pParse, p);
}
@@ -1782,7 +1782,7 @@ sqlite3EndTable(Parse * pParse, /* Parse context */
"only PRIMARY KEY constraint can "
"have ON CONFLICT REPLACE clause "
"- %s", p->def->name);
- return;
+ goto cleanup;
}
if (db->init.busy) {
@@ -1795,7 +1795,7 @@ sqlite3EndTable(Parse * pParse, /* Parse context */
*/
struct ExprList *old_checks = p->def->opts.checks;
if (sql_table_def_rebuild(db, p) != 0)
- return;
+ goto cleanup;
sql_expr_list_delete(db, old_checks);
}
@@ -1923,6 +1923,7 @@ sqlite3EndTable(Parse * pParse, /* Parse context */
* don't require make a copy on space_def_dup and to improve
* debuggability.
*/
+cleanup:
sql_expr_list_delete(db, p->def->opts.checks);
p->def->opts.checks = NULL;
}
--
2.7.4
More information about the Tarantool-patches
mailing list