diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2014-03-30 21:05:35 +0400 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2014-03-30 21:05:35 +0400 |
commit | 32f9800a5910e316c5c8656767dbd00e5ae8ba30 (patch) | |
tree | 96532df4521dc6e53f397d51752a1d1b1241c52b | |
parent | 1a9f67457b3a7b0ab4caaddfa9ee7cbe88b0045d (diff) | |
download | bdwgc-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).
-rw-r--r-- | headers.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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); } |