0d7a60a1cc
GnuTLS has separate initialization and deinitialization procedures for global and per-session state. Previously, haskell-gnutls used Haskell's garbage collector (via ForeignPtr) to manage these separate states by creating a dummy GlobalState type representing an initialized global state. The Session type contained ForeignPtrs to the global and session state, with the idea that GC would collect them both at the same time (albeit in non-determinstic order). It turns out that session deinitialization *requires* an initialized global state, and calling gnutls_deinit() after gnutls_global_deinit() can cause a crash. This patch solves the crash by removing the GlobalState ForeignPtr hack, and ensuring that gnutls_global_deinit() is always called after gnutls_deinit(). Originally reported by Keven McKenzie and Joey Hess. |
||
---|---|---|
.. | ||
Network/Protocol/TLS |