On Saturday 25 June 2016 22:58:59 Ted Unangst wrote: > It's unfortunately unclear from the documentation when it is safe to call > tls_config_free(). One might naively assume after a call to tls_configure, > but that's not correct as the config is also accessed during connect.
Right, we currently keep a reference to the tls_config struct within the context. We could fix this by (a) improving the documentation (only free after all tls contexts have been freed), (b) copying the configuration struct when tls_configure() is called or (c) reference counting on the tls_config. Out of these it is probably preferable to do reference counting so that you can immediately tls_config_free() after tls_configure(). Thoughts?