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

Merged
merged 1 commit into from Feb 19, 2013

3 participants

@nelhage

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
@ibc

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

ibc@0e43c99

@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

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