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 3426C270B0 for ; Thu, 12 Jul 2018 12:34:35 -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 CIYxgwZ35mTB for ; Thu, 12 Jul 2018 12:34:35 -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 E4C64270AA for ; Thu, 12 Jul 2018 12:34:34 -0400 (EDT) From: Kirill Shcherbatov Subject: [tarantool-patches] [PATCH v1 2/2] sql: fixed possible leak in sqlite3EndTable Date: Thu, 12 Jul 2018 19:34:28 +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: v.shpilevoy@tarantool.org, Kirill Shcherbatov --- 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