From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org
Cc: korablev@tarantool.org, Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] [PATCH v1 2/3] sql: fixed possible leak in sqlite3EndTable
Date: Wed, 18 Jul 2018 19:52:21 +0300 [thread overview]
Message-ID: <ea00a55a9f37b0d0bdda43f76b5574281c758be8.1531932662.git.kshcherbatov@tarantool.org> (raw)
In-Reply-To: <cover.1531932662.git.kshcherbatov@tarantool.org>
In-Reply-To: <cover.1531932662.git.kshcherbatov@tarantool.org>
---
src/box/sql/build.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index a023b1e..ee97ef9 100644
--- a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -1684,11 +1684,11 @@ sqlite3EndTable(Parse * pParse, /* Parse context */
sqlite3ErrorMsg(pParse,
"PRIMARY KEY missing on table %s",
p->def->name);
- return;
+ goto cleanup;
} else {
convertToWithoutRowidTable(pParse, p);
if (pParse->nErr > 0)
- return;
+ goto cleanup;
}
}
@@ -1706,7 +1706,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) {
/*
@@ -1718,7 +1718,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);
}
@@ -1736,7 +1736,7 @@ sqlite3EndTable(Parse * pParse, /* Parse context */
v = sqlite3GetVdbe(pParse);
if (NEVER(v == 0))
- return;
+ goto cleanup;
/*
* Initialize zType for the new view or table.
@@ -1821,7 +1821,7 @@ sqlite3EndTable(Parse * pParse, /* Parse context */
if (pOld) {
assert(p == pOld); /* Malloc must have failed inside HashInsert() */
sqlite3OomFault(db);
- return;
+ goto cleanup;
}
pParse->pNewTable = 0;
current_session()->sql_flags |= SQLITE_InternChanges;
@@ -1846,6 +1846,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
next prev parent reply other threads:[~2018-07-18 16:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 16:52 [tarantool-patches] [PATCH v1 0/3] sql: restrict nullable action definitions Kirill Shcherbatov
2018-07-18 16:52 ` [tarantool-patches] [PATCH v1 1/3] " Kirill Shcherbatov
2018-07-18 20:12 ` [tarantool-patches] " n.pettik
2018-07-19 8:12 ` Kirill Shcherbatov
2018-07-20 2:39 ` n.pettik
2018-07-20 7:29 ` Kirill Shcherbatov
2018-07-23 8:31 ` Kirill Shcherbatov
2018-07-23 16:53 ` Kirill Shcherbatov
2018-07-23 19:27 ` n.pettik
2018-07-18 16:52 ` Kirill Shcherbatov [this message]
2018-07-18 20:12 ` [tarantool-patches] Re: [PATCH v1 2/3] sql: fixed possible leak in sqlite3EndTable n.pettik
2018-07-18 16:52 ` [tarantool-patches] [PATCH v1 3/3] sql: get rid of Column structure Kirill Shcherbatov
2018-07-18 20:13 ` [tarantool-patches] " n.pettik
2018-07-19 8:12 ` Kirill Shcherbatov
2018-07-19 8:39 ` Vladislav Shpilevoy
2018-07-19 10:17 ` Kirill Shcherbatov
2018-07-20 2:43 ` n.pettik
2018-07-24 15:26 ` [tarantool-patches] Re: [PATCH v1 0/3] sql: restrict nullable action definitions Kirill Yukhin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ea00a55a9f37b0d0bdda43f76b5574281c758be8.1531932662.git.kshcherbatov@tarantool.org \
--to=kshcherbatov@tarantool.org \
--cc=korablev@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [tarantool-patches] [PATCH v1 2/3] sql: fixed possible leak in sqlite3EndTable' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox