tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] [PATCH] pp table_ident freeing


From: Thomas Preud'homme
Subject: Re: [Tinycc-devel] [PATCH] pp table_ident freeing
Date: Sun, 04 Jan 2015 00:46:59 +0000
User-agent: KMail/4.14.1 (Linux/2.6.38-ac2-ac100; KDE/4.14.2; armv7l; ; )

Le jeudi 1 janvier 2015, 14:17:10 Sergey Korshunoff a écrit :
> Free a memory allocted to identifiers table in the previous call to
> the preprocess_new() function.  Do the same when calling
> tcc_preprocess(0)

diff -urN tinycc.old/tccpp.c tinycc/tccpp.c
--- tinycc.old/tccpp.c  2014-12-30 18:33:52.000000000 +0300
+++ tinycc/tccpp.c      2015-01-01 14:01:36.000000000 +0300
@@ -3111,6 +3111,8 @@
         isidnum_table[i-CH_EOF] = isid(i) || isnum(i);
 
     /* add all tokens */
+    if (table_ident)
+       tcc_free (table_ident);
     table_ident = NULL;
     memset(hash_ident, 0, TOK_HASH_SIZE * sizeof(TokenSym *));
     
The free should be done by calling tcc_cleanup. Also the if is useless as free 
does nothing if its parameter is NULL.

Could you post a testcase of the problem you are encountering? That would help 
me understand why this patch is necessary.

Best regards,

Thomas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]