(EC)DH memory handling fixes.
[openssl.git] / ssl / s3_lib.c
index 9d25e993e3a9430d687f7e3e7ad03d14e66007ca..11c2190ed36c838390d78d4e35d7b01e526e50be 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;