[tarantool-patches] Re: [PATCH v7 0/7] sql: remove Checks to server

Kirill Shcherbatov kshcherbatov at tarantool.org
Fri May 25 15:04:00 MSK 2018


>From 63875ce19a0eababd765680ef46463b2ccf92905 Mon Sep 17 00:00:00 2001
Message-Id: <63875ce19a0eababd765680ef46463b2ccf92905.1527249763.git.kshcherbatov at tarantool.org>
In-Reply-To: <cover.1527084286.git.kshcherbatov at tarantool.org>
References: <cover.1527084286.git.kshcherbatov at tarantool.org>
From: Kirill Shcherbatov <kshcherbatov at tarantool.org>
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





More information about the Tarantool-patches mailing list