From: Ivan Maidanski Date: Sun, 30 Mar 2014 17:05:35 +0000 (+0400) Subject: Fix GC_scratch_last_end_ptr update on GC_scratch_alloc failure X-Git-Tag: gc7_6_0~273 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=32f9800a5910e316c5c8656767dbd00e5ae8ba30;p=gc 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). --- 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); }