mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
newptr should not be NULL
obj_ivar_heap_alloc already handles that situation.
This commit is contained in:
parent
1aa05fddd8
commit
aa190abe20
1 changed files with 3 additions and 7 deletions
10
variable.c
10
variable.c
|
@ -1415,13 +1415,9 @@ obj_ivar_heap_realloc(VALUE obj, int32_t len, size_t newsize)
|
||||||
|
|
||||||
if (ROBJ_TRANSIENT_P(obj)) {
|
if (ROBJ_TRANSIENT_P(obj)) {
|
||||||
const VALUE *orig_ptr = ROBJECT(obj)->as.heap.ivptr;
|
const VALUE *orig_ptr = ROBJECT(obj)->as.heap.ivptr;
|
||||||
if ((newptr = obj_ivar_heap_alloc(obj, newsize)) != NULL) {
|
newptr = obj_ivar_heap_alloc(obj, newsize);
|
||||||
/* ok */
|
|
||||||
}
|
assert(newptr);
|
||||||
else {
|
|
||||||
newptr = ALLOC_N(VALUE, newsize);
|
|
||||||
ROBJ_TRANSIENT_UNSET(obj);
|
|
||||||
}
|
|
||||||
ROBJECT(obj)->as.heap.ivptr = newptr;
|
ROBJECT(obj)->as.heap.ivptr = newptr;
|
||||||
for (i=0; i<(int)len; i++) {
|
for (i=0; i<(int)len; i++) {
|
||||||
newptr[i] = orig_ptr[i];
|
newptr[i] = orig_ptr[i];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue