(EC)DH memory handling fixes.
[openssl.git] / ssl / s3_lib.c
index 9b4d060c5fe1b0e12b67282e676c735b436a9a08..c82dcc744c3e2f5c575b252e54f76007790522f9 100644 (file)
@@ -3021,11 +3021,17 @@ void ssl3_clear(SSL *s)
                }
 #ifndef OPENSSL_NO_DH
        if (s->s3->tmp.dh != NULL)
+               {
                DH_free(s->s3->tmp.dh);
+               s->s3->tmp.dh = NULL;
+               }
 #endif
 #ifndef OPENSSL_NO_ECDH
        if (s->s3->tmp.ecdh != NULL)
+               {
                EC_KEY_free(s->s3->tmp.ecdh);
+               s->s3->tmp.ecdh = NULL;
+               }
 #endif
 
        rp = s->s3->rbuf.buf;