From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 9263521990 for ; Wed, 18 Jul 2018 12:52:27 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bEHezKCOFasW for ; Wed, 18 Jul 2018 12:52:27 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 4981D216E8 for ; Wed, 18 Jul 2018 12:52:27 -0400 (EDT) From: Kirill Shcherbatov Subject: [tarantool-patches] [PATCH v1 2/3] sql: fixed possible leak in sqlite3EndTable Date: Wed, 18 Jul 2018 19:52:21 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: korablev@tarantool.org, Kirill Shcherbatov --- 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