bug-libmatheval
[Top][All Lists]
Advanced

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

Re: [bug-libmatheval] memory leak


From: Aleksandar Samardžić
Subject: Re: [bug-libmatheval] memory leak
Date: Tue, 17 May 2016 09:22:38 +0200
User-agent: Mutt/1.6.1 (2016-04-27)

On Mon, May 16, 2016 at 08:43:04PM +0100, Roderick MacKenzie wrote:
> Hi All,
>   This code:
> 
> void main()
> {
> void *f;
> char buff[100];
> strcpy(buff,"1+1");
> f = evaluator_create (buff);
> assert(f);
> evaluator_destroy (f);
> exit(0);
> }
> 
> gives me a memory leak in valgrind:
> 
> ==19940== 16,386 bytes in 1 blocks are still reachable in loss record 3
> of 3
> ==19940==    at 0x4C28BF6: malloc (vg_replace_malloc.c:299)
> ==19940==    by 0x60A102A: yy_create_buffer (in
> /usr/lib64/libmatheval.so.1.0.0)
> ==19940==    by 0x60A19C8: yylex (in /usr/lib64/libmatheval.so.1.0.0)
> ==19940==    by 0x60A0ABD: yyparse (in /usr/lib64/libmatheval.so.1.0.0)
> ==19940==    by 0x60A21D3: evaluator_create (in
> /usr/lib64/libmatheval.so.1.0.0)
> ==19940==    by 0x4097A8: main (main.c:68)
> 
> I'm going to work around it but thought you guys should know!
> 
> all the best,
> Rod
>

Hello,

Thanks for your message.  I wasn't able to exactly reproduce the problem
you reported, but using libmathteval 1.1.11, built by GCC 5.3.0 (after
proper #include directives added, as the snippet you provided won't
compile otherwise), and Valgrind 3.11.0, I actually have not one, but
three memory leaks reported by Valgrind instead.  However, as already
discussed previously on this list:

https://lists.gnu.org/archive/html/bug-libmatheval/2014-10/msg00000.html

these are leaks from the code generated by Flex, and not caused by
libmatheval code itself.

Regards,
Alex



reply via email to

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