Skip to content

Commit

Permalink
Fix a BIO leak when verifying SSL certificates or calling get_peer_cert.
Browse files Browse the repository at this point in the history
  • Loading branch information
nelhage committed Feb 19, 2013
1 parent d7c8a14 commit b2006a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ext/rubymain.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ static VALUE t_get_peer_cert (VALUE self, VALUE signature)
BIO_get_mem_ptr(out, &buf); BIO_get_mem_ptr(out, &buf);
ret = rb_str_new(buf->data, buf->length); ret = rb_str_new(buf->data, buf->length);
X509_free(cert); X509_free(cert);
BUF_MEM_free(buf); BIO_free(out);
} }
#endif #endif


Expand Down
2 changes: 1 addition & 1 deletion ext/ssl.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ extern "C" int ssl_verify_wrapper(int preverify_ok, X509_STORE_CTX *ctx)


ConnectionDescriptor *cd = dynamic_cast <ConnectionDescriptor*> (Bindable_t::GetObject(binding)); ConnectionDescriptor *cd = dynamic_cast <ConnectionDescriptor*> (Bindable_t::GetObject(binding));
result = (cd->VerifySslPeer(buf->data) == true ? 1 : 0); result = (cd->VerifySslPeer(buf->data) == true ? 1 : 0);
BUF_MEM_free(buf); BIO_free(out);


return result; return result;
} }
Expand Down

0 comments on commit b2006a6

Please sign in to comment.