Hello, On Thu, 26 May 2016, Nathan Sidwell wrote:
> This patch removes the malloc/realloc/free wrappers from libgcc. I've > implemented them completely in C and put them in the ptx newlib port -- > where one expects such functions. It appears that the new Newlib code doesn't free 'p' on 'realloc (p, 0)'; this is a regression from previous behavior. How about the following fix? Alexander diff --git a/newlib/libc/machine/nvptx/realloc.c b/newlib/libc/machine/nvptx/realloc.c index 634507f..5b6bb62 100644 --- a/newlib/libc/machine/nvptx/realloc.c +++ b/newlib/libc/machine/nvptx/realloc.c @@ -34,6 +34,12 @@ void * realloc (void *old_ptr, size_t new_size) { + if (!new_size) + { + free (old_ptr); + return 0; + } + void *new_ptr = malloc (new_size); if (old_ptr && new_ptr)