summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2014-03-30 21:05:35 +0400
committerIvan Maidanski <ivmai@mail.ru>2014-05-03 00:34:21 +0400
commitb9cb8bd02d344fe82216bbae95232395681d8ac8 (patch)
treebcb53000aeaf4c5db894550c0f8ce3b8531a6d7a
parentfc12c339246d10dd42a8e8650223e38aadf2c988 (diff)
downloadbdwgc-b9cb8bd02d344fe82216bbae95232395681d8ac8.tar.gz
Fix GC_scratch_last_end_ptr update on GC_scratch_alloc failure
* headers.c (GC_scratch_alloc): Do not update GC_scratch_last_end_ptr if allocation failed ("result" variable is NULL).
-rw-r--r--headers.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/headers.c b/headers.c
index 4e2c2d09..87f19782 100644
--- a/headers.c
+++ b/headers.c
@@ -134,7 +134,9 @@ GC_INNER ptr_t GC_scratch_alloc(size_t bytes)
result = (ptr_t)GET_MEM(bytes_to_get);
GC_add_to_our_memory(result, bytes_to_get);
scratch_free_ptr -= bytes;
- GC_scratch_last_end_ptr = result + bytes;
+ if (result != NULL) {
+ GC_scratch_last_end_ptr = result + bytes;
+ }
return(result);
}