diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-08-03 21:17:11 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-08-16 14:22:07 +0900 |
commit | 31ddb457bfe55171e657ec04d57defdf7d460370 (patch) | |
tree | 21595bf21304c6823f5ae885dbb5f4532afba8f5 /ext/openssl/ossl_x509req.c | |
parent | 2cb131e1ccdb6536ef3516b49ab90775688db3f3 (diff) | |
download | ruby-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_x509req.c')
-rw-r--r-- | ext/openssl/ossl_x509req.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/openssl/ossl_x509req.c b/ext/openssl/ossl_x509req.c index 7a277597..11cff733 100644 --- a/ext/openssl/ossl_x509req.c +++ b/ext/openssl/ossl_x509req.c @@ -432,7 +432,7 @@ ossl_x509req_set_attributes(VALUE self, VALUE ary) X509_ATTRIBUTE_free(attr); for (i=0;i<RARRAY_LEN(ary); i++) { item = RARRAY_AREF(ary, i); - attr = DupX509AttrPtr(item); + attr = GetX509AttrPtr(item); if (!X509_REQ_add1_attr(req, attr)) { ossl_raise(eX509ReqError, NULL); } @@ -446,7 +446,7 @@ ossl_x509req_add_attribute(VALUE self, VALUE attr) X509_REQ *req; GetX509Req(self, req); - if (!X509_REQ_add1_attr(req, DupX509AttrPtr(attr))) { + if (!X509_REQ_add1_attr(req, GetX509AttrPtr(attr))) { ossl_raise(eX509ReqError, NULL); } |