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 0B3F51FD17 for ; Sat, 5 Jan 2019 08:13:58 -0500 (EST) 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 OwmBzIQfVSw2 for ; Sat, 5 Jan 2019 08:13:57 -0500 (EST) Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 6A4A71FD05 for ; Sat, 5 Jan 2019 08:13:57 -0500 (EST) From: Alexander Turenko Subject: [tarantool-patches] [PATCH] sql: fix lemon memory leak reported by ASAN Date: Sat, 5 Jan 2019 16:13:58 +0300 Message-Id: <9dbcaa3afae39cc46a8e6da5e00b5d62179ed016.1546692811.git.alexander.turenko@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: Nikita Pettik Cc: Alexander Turenko , tarantool-patches@freelists.org It catched by ASAN at build time (lemon is executed to generate parse.[ch]), so tarantool couldn't be built with -DENABLE_ASAN=ON. --- no issue https://github.com/tarantool/tarantool/tree/Totktonada/fix-lemon-memleak extra/lemon.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extra/lemon.c b/extra/lemon.c index 66e425f68..1efaac9e6 100644 --- a/extra/lemon.c +++ b/extra/lemon.c @@ -598,8 +598,11 @@ struct acttab { /* Free all memory associated with the given acttab */ void acttab_free(acttab *p){ - free( p->aAction ); - free( p->aLookahead ); + assert(p); + if (p->aAction) + free( p->aAction ); + if (p->aLookahead) + free( p->aLookahead ); free( p ); } @@ -4255,6 +4258,7 @@ void ReportTable( } } fprintf(out, "};\n"); lineno++; + acttab_free(pActtab); /* Output the yy_shift_ofst[] table */ n = lemp->nxstate; -- 2.20.1