Commit 66606eea authored by Paul Eggert's avatar Paul Eggert
Browse files

* alloc.c (memory_full) [!SYNC_INPUT]: Fix signal-related race.

Without this fix, if a signal arrives just after memory fills up,
'malloc' might be invoked reentrantly.
parent 21956cce
2011-07-28 Paul Eggert <eggert@cs.ucla.edu>
* alloc.c (memory_full) [!SYNC_INPUT]: Fix signal-related race.
Without this fix, if a signal arrives just after memory fills up,
'malloc' might be invoked reentrantly.
* image.c (x_check_image_size) [!HAVE_X_WINDOWS]: Return 1.
In other words, assume that every image size is allowed, on non-X
hosts. This assumption is probably wrong, but it lets Emacs compile.
......
......@@ -3282,12 +3282,16 @@ memory_full (size_t nbytes)
int enough_free_memory = 0;
if (SPARE_MEMORY < nbytes)
{
void *p = malloc (SPARE_MEMORY);
void *p;
MALLOC_BLOCK_INPUT;
p = malloc (SPARE_MEMORY);
if (p)
{
free (p);
enough_free_memory = 1;
}
MALLOC_UNBLOCK_INPUT;
}
if (! enough_free_memory)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment