[Top][All Lists]

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

Re: Invalid memory usage in GLPK

From: Andrew Makhorin
Subject: Re: Invalid memory usage in GLPK
Date: Mon, 03 Aug 2020 23:26:35 +0300

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]