aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_bn.c
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2017-09-25 12:07:53 +0900
committerKazuki Yamaguchi <k@rhe.jp>2017-09-25 13:03:21 +0900
commit5c1c0fa507fc517596041c7bee9aa34172425649 (patch)
treea32839c15484fb820950b7a00c5d62c9cceedc1f /ext/openssl/ossl_bn.c
parente72d960db2623b21ee001b5a7b9d9e6ff55bdf94 (diff)
downloadruby-openssl-5c1c0fa507fc517596041c7bee9aa34172425649.tar.gz
bn: use ALLOCV() macro instead of xmalloc()
Diffstat (limited to 'ext/openssl/ossl_bn.c')
-rw-r--r--ext/openssl/ossl_bn.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c
index d337d509..4666ce6c 100644
--- a/ext/openssl/ossl_bn.c
+++ b/ext/openssl/ossl_bn.c
@@ -979,20 +979,20 @@ static VALUE
ossl_bn_hash(VALUE self)
{
BIGNUM *bn;
- VALUE hash;
+ VALUE tmp, hash;
unsigned char *buf;
int len;
GetBN(self, bn);
len = BN_num_bytes(bn);
- buf = xmalloc(len);
+ buf = ALLOCV(tmp, len);
if (BN_bn2bin(bn, buf) != len) {
- xfree(buf);
- ossl_raise(eBNError, NULL);
+ ALLOCV_END(tmp);
+ ossl_raise(eBNError, "BN_bn2bin");
}
hash = ST2FIX(rb_memhash(buf, len));
- xfree(buf);
+ ALLOCV_END(tmp);
return hash;
}