bug-glpk
[Top][All Lists]
Advanced

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

Re: Invalid memory usage in GLPK


From: Domingo Alvarez Duarte
Subject: Re: Invalid memory usage in GLPK
Date: Tue, 4 Aug 2020 09:21:32 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Hello Andrew !

Thank you for pointing out my fault macro !

After this fix valgrind does not report any error.

Cheers !

On 3/8/20 22:26, Andrew Makhorin wrote:
On Mon, 2020-08-03 at 20:45 +0200, Heinrich Schuchardt wrote:
On 03.08.20 17:56, Domingo Alvarez Duarte wrote:
[...]
+#if defined(GLP_NO_MEMORY_POOL)
+#define xrealloc(ptr, n, size) realloc(ptr, n*size)
+#define trealloc(ptr, n, type) ((type *)realloc(ptr,
n*sizeof(type)))

You need to protect macro arguments by parentheses like this:

+#define xrealloc(ptr, n, size) realloc(ptr, (n)*(size))

because n and size can be expressions.



reply via email to

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