mruby-bigint (mrb_bint_2comp): need to initialize mpz_t

This commit is contained in:
Yukihiro "Matz" Matsumoto
2024-10-17 15:48:37 +09:00
parent c3be2568ea
commit a5c0b2114a
+1
View File
@@ -1888,6 +1888,7 @@ mrb_bint_2comp(mrb_state *mrb, mrb_value x)
mpz_t a, z;
bint_as_mpz(RBIGINT(x), &a);
mpz_init(mrb, &z);
mrb_assert(a.sn < 0);
size_t size = a.sz;
mpz_realloc(mrb, &z, size);