Open tosttost opened 3 years ago
Partially fixed by https://github.com/coin-or/Cgl/commit/e5adc40d6a72b74a0df881e0dba2208e4933f545.
Moving append()
into CoinUtils (https://github.com/coin-or/CoinUtils/blob/master/src/CoinHelperFunctions.hpp), renaming it to something CoinRealloc...
like, and using it here would be nice. Having a function append()
in the global namespace could be confusing.
passing NULL to memcpy is undefined behaviour. But: Does memcpy actually causes trouble? probably not - it's hard to image an implementation that does not 'accidently' gets it right. I have no hint that any coin-or software misbehaves.
Why fix this?
void attribute ((noinline)) foo(int a, int b, int n) { memcpy(b, a, n);
if(a == NULL) { std::cout << "a is NULL" << std::endl; } }
int main() { int* a = NULL; int b[3]; foo(a, b, 0);
return 0; }