diff options
| author | Jean Boussier <jean.boussier@gmail.com> | 2026-01-31 05:28:52 +0100 |
|---|---|---|
| committer | Jean Boussier <jean.boussier@gmail.com> | 2026-01-31 10:35:48 +0100 |
| commit | bcbc6ed57112e1e4ad76fb2db6c9c7b35685b890 (patch) | |
| tree | 0260b1dd240dac58d2a6ec1d89e1050ce73b4842 | |
| parent | 0584f9fb0951bee3ea2645bdba0af56a2b320ed3 (diff) | |
bignum.c: Replace ruby_xfree by ruby_sized_xfree when applicable
| -rw-r--r-- | bignum.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -3036,12 +3036,13 @@ rb_big_realloc(VALUE big, size_t len) else { if (len <= embed_capa) { ds = RBIGNUM(big)->as.heap.digits; + size_t old_len = RBIGNUM(big)->as.heap.len; FL_SET_RAW(big, BIGNUM_EMBED_FLAG); BIGNUM_SET_LEN(big, len); (void)VALGRIND_MAKE_MEM_UNDEFINED((void*)RBIGNUM(big)->as.ary, embed_capa * sizeof(BDIGIT)); if (ds) { MEMCPY(RBIGNUM(big)->as.ary, ds, BDIGIT, len); - xfree(ds); + SIZED_FREE_N(ds, old_len); } } else { @@ -3049,7 +3050,7 @@ rb_big_realloc(VALUE big, size_t len) RBIGNUM(big)->as.heap.digits = ALLOC_N(BDIGIT, len); } else if (BIGNUM_LEN(big) != len) { - REALLOC_N(RBIGNUM(big)->as.heap.digits, BDIGIT, len); + SIZED_REALLOC_N(RBIGNUM(big)->as.heap.digits, BDIGIT, len, BIGNUM_LEN(big)); } } } |
