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 2A57E254FE for ; Fri, 25 May 2018 08:04:03 -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 wfBtLzIesq-Z for ; Fri, 25 May 2018 08:04:03 -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 D4F02254FA for ; Fri, 25 May 2018 08:04:02 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v7 0/7] sql: remove Checks to server References: From: Kirill Shcherbatov Message-ID: <58b6dc63-777e-0d16-fe94-751cecdbf515@tarantool.org> Date: Fri, 25 May 2018 15:04:00 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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" >From 63875ce19a0eababd765680ef46463b2ccf92905 Mon Sep 17 00:00:00 2001 Message-Id: <63875ce19a0eababd765680ef46463b2ccf92905.1527249763.git.kshcherbatov@tarantool.org> In-Reply-To: References: From: Kirill Shcherbatov Date: Fri, 25 May 2018 11:41:32 +0300 Subject: [PATCH 1/8] sql: fix memory leaks in hash and on OP_RenameTable --- src/box/sql/hash.c | 1 + src/box/sql/vdbe.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/box/sql/hash.c b/src/box/sql/hash.c index b6f3ff3..84dfc36 100644 --- a/src/box/sql/hash.c +++ b/src/box/sql/hash.c @@ -238,6 +238,7 @@ removeElementGivenHash(Hash * pH, /* The pH containing "elem" */ pEntry->count--; assert(pEntry->count >= 0); } + free(elem->pKey); sqlite3_free(elem); pH->count--; if (pH->count == 0) { diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c index 3a1e2e0..3fe5875 100644 --- a/src/box/sql/vdbe.c +++ b/src/box/sql/vdbe.c @@ -4804,6 +4804,7 @@ case OP_RenameTable: { /* Rename all trigger created on this table.*/ for (; pTrig; pTrig = pTrig->pNext) { + sqlite3DbFree(db, pTrig->table); pTrig->table = sqlite3DbStrNDup(db, zNewTableName, sqlite3Strlen30(zNewTableName)); pTrig->pTabSchema = pTab->pSchema; -- 2.7.4