зеркало из https://github.com/github/ruby.git
Fix incorrect size of WeakMap buffer
In wmap_final_func, j is the number of elements + 1 (since j also includes the length at the 0th index), so we should resize the buffer to size j and the new length is j - 1.
This commit is contained in:
Родитель
671ddb1eee
Коммит
e0cf80d666
|
@ -163,8 +163,8 @@ wmap_final_func(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
|
|||
return ST_DELETE;
|
||||
}
|
||||
if (j < i) {
|
||||
SIZED_REALLOC_N(ptr, VALUE, j + 1, i);
|
||||
ptr[0] = j;
|
||||
SIZED_REALLOC_N(ptr, VALUE, j, i);
|
||||
ptr[0] = j - 1;
|
||||
*value = (st_data_t)ptr;
|
||||
}
|
||||
return ST_CONTINUE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче