Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org
Cc: v.shpilevoy@tarantool.org,
	Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] [PATCH v1 2/2] sql: fixed possible leak in sqlite3EndTable
Date: Thu, 12 Jul 2018 19:34:28 +0300	[thread overview]
Message-ID: <b308b66901143da53bcbdef5afef2b0f23565e05.1531413185.git.kshcherbatov@tarantool.org> (raw)
In-Reply-To: <cover.1531413184.git.kshcherbatov@tarantool.org>
In-Reply-To: <cover.1531413184.git.kshcherbatov@tarantool.org>

---
 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

  parent reply	other threads:[~2018-07-12 16:34 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-12 16:34 [tarantool-patches] [PATCH v1 0/2] sql: restrict nullable action definitions Kirill Shcherbatov
2018-07-12 16:34 ` [tarantool-patches] [PATCH v1 1/2] " Kirill Shcherbatov
2018-07-13 10:26   ` [tarantool-patches] " Vladislav Shpilevoy
2018-07-13 16:05     ` Kirill Shcherbatov
2018-07-13 20:03       ` Vladislav Shpilevoy
2018-07-16  9:43         ` Kirill Shcherbatov
2018-07-16 10:20           ` Vladislav Shpilevoy
2018-07-16 12:27             ` Kirill Shcherbatov
2018-07-12 16:34 ` Kirill Shcherbatov [this message]
2018-07-13 10:26   ` [tarantool-patches] Re: [PATCH v1 2/2] sql: fixed possible leak in sqlite3EndTable Vladislav Shpilevoy
2018-07-13 16:05     ` Kirill Shcherbatov
2018-07-13 10:26 ` [tarantool-patches] Re: [PATCH v1 0/2] sql: restrict nullable action definitions Vladislav Shpilevoy
2018-07-16 12:28 ` [tarantool-patches] [PATCH v1 2/4] sql: refactor sqlite3AddNotNull function Kirill Shcherbatov
2018-07-16 13:41   ` [tarantool-patches] " Vladislav Shpilevoy
2018-07-16 12:28 ` [tarantool-patches] [PATCH v1 4/4] sql: get rid of Column structure Kirill Shcherbatov
2018-07-16 13:40   ` [tarantool-patches] " Vladislav Shpilevoy
2018-07-16 16:33     ` Kirill Shcherbatov
2018-07-17  9:32       ` Vladislav Shpilevoy
2018-07-17 14:08         ` Kirill Shcherbatov
2018-07-17 22:01           ` Vladislav Shpilevoy
2018-07-18  7:25             ` Kirill Shcherbatov
2018-07-18  8:04               ` Vladislav Shpilevoy
2018-07-18 16:41                 ` n.pettik

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=b308b66901143da53bcbdef5afef2b0f23565e05.1531413185.git.kshcherbatov@tarantool.org \
    --to=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] [PATCH v1 2/2] 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