Issue #2022 has been updated by Nikolai Lugovoi. Though patch applies well for compilation, it results in some random segfaults with openssl-1.0beta3, from test/openssl/test_ssl.rb, when SSLContext is garbage collected before referencing SSLSocket - in all ruby versions - 1.8.6, 1.8.7 and 1.9.2dev As workaround, I tried to check references count in ossl_ssl.c: static void ossl_sslctx_free(SSL_CTX *ctx) { + if(ctx && ctx->references > 1) return; if(ctx && SSL_CTX_get_ex_data(ctx, ossl_ssl_ex_store_p)== (void*)1) ctx->cert_store = NULL; SSL_CTX_free(ctx) that seemed to eliminate segfaults, but not sure if it does not introduce memory leaks. ---------------------------------------- http://redmine.ruby-lang.org/issues/show/2022 ---------------------------------------- http://redmine.ruby-lang.org