Skip to content

Commit 5c1c0fa

Browse files
committed
bn: use ALLOCV() macro instead of xmalloc()
1 parent e72d960 commit 5c1c0fa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ext/openssl/ossl_bn.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -979,20 +979,20 @@ static VALUE
979979
ossl_bn_hash(VALUE self)
980980
{
981981
BIGNUM *bn;
982-
VALUE hash;
982+
VALUE tmp, hash;
983983
unsigned char *buf;
984984
int len;
985985

986986
GetBN(self, bn);
987987
len = BN_num_bytes(bn);
988-
buf = xmalloc(len);
988+
buf = ALLOCV(tmp, len);
989989
if (BN_bn2bin(bn, buf) != len) {
990-
xfree(buf);
991-
ossl_raise(eBNError, NULL);
990+
ALLOCV_END(tmp);
991+
ossl_raise(eBNError, "BN_bn2bin");
992992
}
993993

994994
hash = ST2FIX(rb_memhash(buf, len));
995-
xfree(buf);
995+
ALLOCV_END(tmp);
996996

997997
return hash;
998998
}

0 commit comments

Comments
 (0)