diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-01-25 17:04:12 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-02-15 20:13:44 -0500 |
commit | 4dc228e35bbedb6f451a621db4a756ead9560a76 (patch) | |
tree | 36d6629b98182f796abeeaab94215ae4cd4e9e74 /configure.ac | |
parent | 7a74b3663fdaa40fc84e48990d15953a8f46a2bf (diff) | |
download | tor-4dc228e35bbedb6f451a621db4a756ead9560a76.tar.gz tor-4dc228e35bbedb6f451a621db4a756ead9560a76.zip |
Remove workaround code for systems where free(NULL) is busted.
Add an autoconf test to make sure we won't regret it.
Closes ticket 24484.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 3cb187b0e9..3795faddcb 100644 --- a/configure.ac +++ b/configure.ac @@ -615,6 +615,21 @@ fi AM_CONDITIONAL(BUILD_READPASSPHRASE_C, test "x$ac_cv_func_readpassphrase" = "xno" && test "$bwin32" = "false") +AC_MSG_CHECKING([whether free(NULL) works]) +AC_RUN_IFELSE([AC_LANG_PROGRAM([ + #include <stdlib.h> +], [ +char *p = NULL; +free(p); +])], +[free_null_ok=true; AC_MSG_RESULT(yes)], +[free_null_ok=false; AC_MSG_RESULT(no)], +[free_null_ok=cross; AC_MSG_RESULT(cross)]) + +if test "$free_null_ok" = "false"; then + AC_MSG_ERROR([Your libc implementation doesn't allow free(NULL), as required by C99.]) +fi + dnl ------------------------------------------------------ dnl Where do you live, libevent? And how do we call you? |