summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ralloc.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ralloc.c b/src/ralloc.c
index d1ce3be24fc..183db755412 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -363,7 +363,18 @@ relinquish ()
}
if ((*real_morecore) (- excess) == 0)
- abort ();
+ {
+ /* If the system didn't want that much memory back, adjust
+ the end of the last heap to reflect that. This can occur
+ if break_value is still within the original data segment. */
+ last_heap->end += excess;
+ /* Make sure that the result of the adjustment is accurate.
+ It should be, for the else clause above; the other case,
+ which returns the entire last heap to the system, seems
+ unlikely to trigger this mode of failure. */
+ if (last_heap->end != (*real_morecore) (0))
+ abort ();
+ }
}
}