[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master b4788b9: Catch malloc_get_state, malloc_set_state f
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master b4788b9: Catch malloc_get_state, malloc_set_state failure |
Date: |
Sat, 11 Jun 2016 00:19:10 +0000 (UTC) |
branch: master
commit b4788b9394f3c9d50468607cbcf82e9490fa7c1d
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Catch malloc_get_state, malloc_set_state failure
This should help insulate Emacs better from configuration screwups.
Future versions of the GNU C library are planned to deprecate
these functions, but will continue to support them in
already-built-and-dumped Emacs executables.
* src/alloc.c (malloc_initialize_hook) [DOUG_LEA_MALLOC]:
Abort if malloc_set_state fails.
(alloc_unexec_pre) [DOUG_LEA_MALLOC]:
Report malloc_get_state failure, and exit.
---
src/alloc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/alloc.c b/src/alloc.c
index 054e1ca..3feed51 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -20,6 +20,7 @@ along with GNU Emacs. If not, see
<http://www.gnu.org/licenses/>. */
#include <config.h>
+#include <errno.h>
#include <stdio.h>
#include <limits.h> /* For CHAR_BIT. */
#include <signal.h> /* For SIGABRT, SIGDANGER. */
@@ -150,7 +151,8 @@ malloc_initialize_hook (void)
}
}
- malloc_set_state (malloc_state_ptr);
+ if (malloc_set_state (malloc_state_ptr) != 0)
+ emacs_abort ();
# ifndef XMALLOC_OVERRUN_CHECK
alloc_unexec_post ();
# endif
@@ -174,6 +176,8 @@ alloc_unexec_pre (void)
{
#ifdef DOUG_LEA_MALLOC
malloc_state_ptr = malloc_get_state ();
+ if (!malloc_state_ptr)
+ fatal ("malloc_get_state: %s", strerror (errno));
#endif
#ifdef HYBRID_MALLOC
bss_sbrk_did_unexec = true;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master b4788b9: Catch malloc_get_state, malloc_set_state failure,
Paul Eggert <=