]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Port better to gcc -fsanitize=address
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 6 Feb 2016 18:13:50 +0000 (10:13 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 7 Feb 2016 01:17:48 +0000 (17:17 -0800)
* lib/autoconf/functions.m4 (_AC_FUNC_MALLOC_IF, _AC_FUNC_REALLOC_IF):
Free heap-allocated storage before exiting.

lib/autoconf/functions.m4

index 51ae5a42ca3312eb71f5325a5f64785a478ddd13..edc666d4578afe3179fda2b99f8f47bd68398aa1 100644 (file)
@@ -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 # ((