diff options
author | Urabe, Shyouhei <shyouhei@ruby-lang.org> | 2019-04-25 13:10:29 +0900 |
---|---|---|
committer | Urabe, Shyouhei <shyouhei@ruby-lang.org> | 2019-04-26 15:59:40 +0900 |
commit | aa190abe207c9cdbd75a5f8670a4e613565ee6bf (patch) | |
tree | e79f7e483b16c035f2b7aec66977e4e73e202abd /variable.c | |
parent | 1aa05fddd81846bfa2833dff5e0aaccc1e707c81 (diff) | |
download | ruby-aa190abe207c9cdbd75a5f8670a4e613565ee6bf.tar.gz |
newptr should not be NULL
obj_ivar_heap_alloc already handles that situation.
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/variable.c b/variable.c index cb24076dd0..482b084e38 100644 --- a/variable.c +++ b/variable.c @@ -1415,13 +1415,9 @@ obj_ivar_heap_realloc(VALUE obj, int32_t len, size_t newsize) if (ROBJ_TRANSIENT_P(obj)) { const VALUE *orig_ptr = ROBJECT(obj)->as.heap.ivptr; - if ((newptr = obj_ivar_heap_alloc(obj, newsize)) != NULL) { - /* ok */ - } - else { - newptr = ALLOC_N(VALUE, newsize); - ROBJ_TRANSIENT_UNSET(obj); - } + newptr = obj_ivar_heap_alloc(obj, newsize); + + assert(newptr); ROBJECT(obj)->as.heap.ivptr = newptr; for (i=0; i<(int)len; i++) { newptr[i] = orig_ptr[i]; |