summaryrefslogtreecommitdiff
path: root/headers.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2014-03-30 21:05:35 +0400
committerIvan Maidanski <ivmai@mail.ru>2014-03-30 21:05:35 +0400
commit32f9800a5910e316c5c8656767dbd00e5ae8ba30 (patch)
tree96532df4521dc6e53f397d51752a1d1b1241c52b /headers.c
parent1a9f67457b3a7b0ab4caaddfa9ee7cbe88b0045d (diff)
downloadbdwgc-32f9800a5910e316c5c8656767dbd00e5ae8ba30.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).
Diffstat (limited to 'headers.c')
-rw-r--r--headers.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/headers.c b/headers.c
index ea83378e..108adf18 100644
--- a/headers.c
+++ b/headers.c
@@ -133,7 +133,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);
}