Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko <alexander.turenko@tarantool.org>
To: Nikita Pettik <korablev@tarantool.org>
Cc: Alexander Turenko <alexander.turenko@tarantool.org>,
	tarantool-patches@freelists.org
Subject: [tarantool-patches] [PATCH] sql: fix lemon memory leak reported by ASAN
Date: Sat,  5 Jan 2019 16:13:58 +0300	[thread overview]
Message-ID: <9dbcaa3afae39cc46a8e6da5e00b5d62179ed016.1546692811.git.alexander.turenko@tarantool.org> (raw)

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

             reply	other threads:[~2019-01-05 13:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-05 13:13 Alexander Turenko [this message]
2019-01-09  7:20 ` [tarantool-patches] " Kirill Yukhin
2019-01-09  8:57   ` Alexander Turenko
2019-01-09 11:39     ` n.pettik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9dbcaa3afae39cc46a8e6da5e00b5d62179ed016.1546692811.git.alexander.turenko@tarantool.org \
    --to=alexander.turenko@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH] sql: fix lemon memory leak reported by ASAN' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox