phonohawk/HsOpenSSL — pull request #13 by mvv (2012-04-16 14:16:59+00:00)
Title: Fixed early verification callback deallocation crash.

Embarrassingly, there is a bug in my verification callback support code
which leads to RTS crashes:
1. `SSLContext` is created.
2. Verification callback is installed and allocated `FunPtr` is written
to `ctxVfCb` `IORef`.
3. An `SSL` is created using the `SSLContext`.
4. The `SSLContext` is GCed and the finalizer calls `freeHaskellFunPtr`.
5. `connect` is called on the `SSL`.
6. KABOOM! Freed verification `FunPtr` is called.

The solution is to keep a reference to the `SSLContext` in each `SSL`
created from it. This prevents verification callback from deallocation,
until there is no sessions left to call it.