We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e72d960 commit 5c1c0faCopy full SHA for 5c1c0fa
ext/openssl/ossl_bn.c
@@ -979,20 +979,20 @@ static VALUE
979
ossl_bn_hash(VALUE self)
980
{
981
BIGNUM *bn;
982
- VALUE hash;
+ VALUE tmp, hash;
983
unsigned char *buf;
984
int len;
985
986
GetBN(self, bn);
987
len = BN_num_bytes(bn);
988
- buf = xmalloc(len);
+ buf = ALLOCV(tmp, len);
989
if (BN_bn2bin(bn, buf) != len) {
990
- xfree(buf);
991
- ossl_raise(eBNError, NULL);
+ ALLOCV_END(tmp);
+ ossl_raise(eBNError, "BN_bn2bin");
992
}
993
994
hash = ST2FIX(rb_memhash(buf, len));
995
996
997
return hash;
998
0 commit comments