diff -ur /var/tmp/postfix-3.5.5/src/tls/tls_misc.c ./src/tls/tls_misc.c --- /var/tmp/postfix-3.5.5/src/tls/tls_misc.c 2020-07-12 16:41:51.000000000 -0400 +++ ./src/tls/tls_misc.c 2020-07-26 13:03:13.783128000 -0400 @@ -922,8 +922,6 @@ */ if (SSL_get_signature_nid(ssl, &nid) && nid != NID_undef) locl_sig_dgst = OBJ_nid2sn(nid); - - X509_free(cert); } /* Signature algorithms for the peer end of the connection */ if ((cert = SSL_get_peer_certificate(ssl)) != 0) { @@ -965,6 +963,8 @@ */ if (SSL_get_peer_signature_nid(ssl, &nid) && nid != NID_undef) peer_sig_dgst = OBJ_nid2sn(nid); + + X509_free(cert); } if (kex_name) { TLScontext->kex_name = mystrdup(kex_name);