Skip to content

Commit aa190ab

Browse files
committed
newptr should not be NULL
obj_ivar_heap_alloc already handles that situation.
1 parent 1aa05fd commit aa190ab

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

variable.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,13 +1415,9 @@ obj_ivar_heap_realloc(VALUE obj, int32_t len, size_t newsize)
14151415

14161416
if (ROBJ_TRANSIENT_P(obj)) {
14171417
const VALUE *orig_ptr = ROBJECT(obj)->as.heap.ivptr;
1418-
if ((newptr = obj_ivar_heap_alloc(obj, newsize)) != NULL) {
1419-
/* ok */
1420-
}
1421-
else {
1422-
newptr = ALLOC_N(VALUE, newsize);
1423-
ROBJ_TRANSIENT_UNSET(obj);
1424-
}
1418+
newptr = obj_ivar_heap_alloc(obj, newsize);
1419+
1420+
assert(newptr);
14251421
ROBJECT(obj)->as.heap.ivptr = newptr;
14261422
for (i=0; i<(int)len; i++) {
14271423
newptr[i] = orig_ptr[i];

0 commit comments

Comments
 (0)