From 965c9f9865a1f2e7447294d3a4f7d1e23c097691 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 9 Mar 2016 23:12:25 +0300 Subject: [PATCH] Refactoring of mark_and_push_stack (check GC_base result for null) * mark.c (GC_mark_and_push_stack): Check GC_base() result (do not pass NULL to HDR()). --- mark.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/mark.c b/mark.c index de57bec1..37de535d 100644 --- a/mark.c +++ b/mark.c @@ -1436,15 +1436,12 @@ GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void *obj, PREFETCH(p); GET_HDR(p, hhdr); - if (EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr), FALSE)) { - if (hhdr != 0) { - r = GC_base(p); - hhdr = HDR(r); - } - if (hhdr == 0) { - GC_ADD_TO_BLACK_LIST_STACK(p, source); - return; - } + if (EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr), FALSE) + && (NULL == hhdr + || (r = GC_base(p)) == NULL + || (hhdr = HDR(r)) == NULL)) { + GC_ADD_TO_BLACK_LIST_STACK(p, source); + return; } if (EXPECT(HBLK_IS_FREE(hhdr), FALSE)) { GC_ADD_TO_BLACK_LIST_NORMAL(p, source); -- 2.40.0