aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_x509attr.c
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-08-03 21:17:11 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-08-16 14:22:07 +0900
commit31ddb457bfe55171e657ec04d57defdf7d460370 (patch)
tree21595bf21304c6823f5ae885dbb5f4532afba8f5 /ext/openssl/ossl_x509attr.c
parent2cb131e1ccdb6536ef3516b49ab90775688db3f3 (diff)
downloadruby-openssl-31ddb457bfe55171e657ec04d57defdf7d460370.tar.gz
x509req: fix memory leaks in #set_attributes and #add_attribute
X509_REQ_add1_attr() dups the X509_ATTRIBUTE given as the argument, so we don't need to duplicate beforehand.
Diffstat (limited to 'ext/openssl/ossl_x509attr.c')
-rw-r--r--ext/openssl/ossl_x509attr.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/ext/openssl/ossl_x509attr.c b/ext/openssl/ossl_x509attr.c
index 67b00b14..ae0b347b 100644
--- a/ext/openssl/ossl_x509attr.c
+++ b/ext/openssl/ossl_x509attr.c
@@ -72,16 +72,13 @@ ossl_x509attr_new(X509_ATTRIBUTE *attr)
}
X509_ATTRIBUTE *
-DupX509AttrPtr(VALUE obj)
+GetX509AttrPtr(VALUE obj)
{
- X509_ATTRIBUTE *attr, *new;
+ X509_ATTRIBUTE *attr;
SafeGetX509Attr(obj, attr);
- if (!(new = X509_ATTRIBUTE_dup(attr))) {
- ossl_raise(eX509AttrError, NULL);
- }
- return new;
+ return attr;
}
/*