summaryrefslogtreecommitdiff
path: root/lib/autoconf/functions.m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-02-06 10:13:50 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2016-02-06 17:17:48 -0800
commit14f568f6830b49214e0ad020c9d30559ce8abc7d (patch)
tree66a366050a992811122a10b168d4f85e21f95a3e /lib/autoconf/functions.m4
parent09b6e78d1592ce10fdc975025d699ee41444aa3f (diff)
downloadautoconf-14f568f6830b49214e0ad020c9d30559ce8abc7d.tar.gz
Port better to gcc -fsanitize=address
* lib/autoconf/functions.m4 (_AC_FUNC_MALLOC_IF, _AC_FUNC_REALLOC_IF): Free heap-allocated storage before exiting.
Diffstat (limited to 'lib/autoconf/functions.m4')
-rw-r--r--lib/autoconf/functions.m410
1 files changed, 8 insertions, 2 deletions
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 <stdlib.h>
]],
- [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 <stdlib.h>
]],
- [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 # ((