*_ssl_io = NULL;
i_assert(ssl_io->refcount > 0);
- if (--ssl_io->refcount >= 0)
+ if (--ssl_io->refcount > 0)
return;
ssl_iostream_free(ssl_io);
const char *dnsname;
bool dns_names = FALSE;
unsigned int i, count;
+ int ret;
cert = SSL_get_peer_certificate(ssl);
i_assert(cert != NULL);
}
}
sk_GENERAL_NAME_pop_free(gnames, GENERAL_NAME_free);
- X509_free(cert);
/* verify against CommonName only when there wasn't any DNS
SubjectAltNames */
if (dns_names)
- return i < count ? 0 : -1;
-
- return strcmp(get_cname(cert), verify_name) == 0 ? 0 : -1;
+ ret = i < count ? 0 : -1;
+ else
+ ret = strcmp(get_cname(cert), verify_name) == 0 ? 0 : -1;
+ X509_free(cert);
+ return ret;
}
int ssl_iostream_cert_match_name(struct ssl_iostream *ssl_io,
sstream->ssl_io->ssl_output = NULL;
ssl_iostream_unref(&sstream->ssl_io);
- i_free(sstream->buffer);
+ if (sstream->buffer != NULL)
+ buffer_free(&sstream->buffer);
}
static size_t