Make DH_free() free up any ex_data and also call the finish method.
[openssl.git] / crypto / dh / dh_lib.c
index ef622629f7ed1541912cc5297c71c63e15b7bb0d..48b9db2ac06996e3d64b0db96ff80b3eef5d59e3 100644 (file)
@@ -143,6 +143,10 @@ void DH_free(DH *r)
        }
 #endif
 
+       CRYPTO_free_ex_data(dh_meth, (char *)r, &r->ex_data);
+
+       if(r->meth->finish) r->meth->finish(r);
+
        if (r->p != NULL) BN_clear_free(r->p);
        if (r->g != NULL) BN_clear_free(r->g);
        if (r->pub_key != NULL) BN_clear_free(r->pub_key);