From: Paul Eggert Date: Sat, 6 Feb 2016 18:13:50 +0000 (-0800) Subject: Port better to gcc -fsanitize=address X-Git-Tag: v2.69b~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14f568f6830b49214e0ad020c9d30559ce8abc7d;p=thirdparty%2Fautoconf.git Port better to gcc -fsanitize=address * lib/autoconf/functions.m4 (_AC_FUNC_MALLOC_IF, _AC_FUNC_REALLOC_IF): Free heap-allocated storage before exiting. --- diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index 51ae5a42..edc666d4 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -905,7 +905,10 @@ AC_CACHE_CHECK([for GNU libc compatible malloc], ac_cv_func_malloc_0_nonnull, [AC_LANG_PROGRAM( [[#include ]], - [return ! malloc (0);])], + [char *p = malloc (0); + int result = !p; + free (p); + return result;])], [ac_cv_func_malloc_0_nonnull=yes], [ac_cv_func_malloc_0_nonnull=no], [case "$host_os" in # (( @@ -1409,7 +1412,10 @@ AC_CACHE_CHECK([for GNU libc compatible realloc], ac_cv_func_realloc_0_nonnull, [AC_LANG_PROGRAM( [[#include ]], - [return ! realloc (0, 0);])], + [char *p = realloc (0, 0); + int result = !p; + free (p); + return result;])], [ac_cv_func_realloc_0_nonnull=yes], [ac_cv_func_realloc_0_nonnull=no], [case "$host_os" in # ((