Fix a BIO leak when verifying SSL certificates or calling get_peer_cert. #403

Merged
merged 1 commit into from Feb 19, 2013

Conversation

Projects
None yet
3 participants
Contributor

nelhage commented Feb 19, 2013

You can verify this with a modification of the trivial start_tls example program. Prior to this patch, the following program's memory usage will grow unboundedly.

require 'eventmachine'

module Handler
  def post_init
    puts "Starting TLS"
    start_tls
  end

  def ssl_handshake_completed
    puts "Connected. Cert:"
    puts get_peer_cert
    loop { get_peer_cert }
  end

  def unbind
    EventMachine::stop_event_loop
  end
end

EventMachine.run do
  EventMachine.connect "mail.google.com", 443, Handler
end
Contributor

ibc commented Feb 19, 2013

Good catch! I've applied it in EM-LE:

ibc/EventMachine-LE@0e43c99

tmm1 added a commit that referenced this pull request Feb 19, 2013

Merge pull request #403 from nelhage/ssl-leak
Fix a BIO leak when verifying SSL certificates or calling get_peer_cert.

@tmm1 tmm1 merged commit 016800f into eventmachine:master Feb 19, 2013

@tmm1 tmm1 referenced this pull request Feb 28, 2013

Open

Memory leak with start_tls #266

@nelhage nelhage deleted the nelhage:ssl-leak branch Oct 17, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment