if (!ret) {
BIO_printf(bio_err, "Could not convert PSK key '%s' to BIGNUM\n",
psk_key);
- if (bn)
- BN_free(bn);
+ BN_free(bn);
return 0;
}
if (BN_num_bytes(bn) > (int)max_psk_len) {
{
EBCDIC_OUTBUFF *wbuf;
- wbuf = app_malloc(sizeof(EBCDIC_OUTBUFF) + 1024, "ebcdef wbuf");
+ wbuf = app_malloc(sizeof(*wbuf) + 1024, "ebcdic wbuf");
wbuf->alloced = 1024;
wbuf->buff[0] = '\0';
{
if (a == NULL)
return (0);
- if (a->ptr != NULL)
- OPENSSL_free(a->ptr);
+ OPENSSL_free(a->ptr);
a->ptr = NULL;
a->init = 0;
a->flags = 0;
num = num + num; /* double the size */
if (num < inl)
num = inl;
- wbuf = app_malloc(sizeof(EBCDIC_OUTBUFF) + num, "grow ebcdic wbuf");
+ wbuf = app_malloc(sizeof(*wbuf) + num, "grow ebcdic wbuf");
OPENSSL_free(b->ptr);
wbuf->alloced = num;
static int cert_status_cb(SSL *s, void *arg)
{
tlsextstatusctx *srctx = arg;
- char *host, *port, *path;
+ char *host = NULL, *port = NULL, *path = NULL;
int use_ssl;
unsigned char *rspder = NULL;
int rspderlen;
OPENSSL_free(port);
X509_email_free(aia);
}
- if (id)
- OCSP_CERTID_free(id);
- if (req)
- OCSP_REQUEST_free(req);
- if (resp)
- OCSP_RESPONSE_free(resp);
+ OCSP_CERTID_free(id);
+ OCSP_REQUEST_free(req);
+ OCSP_RESPONSE_free(resp);
return ret;
err:
ret = SSL_TLSEXT_ERR_ALERT_FATAL;
break;
#ifndef OPENSSL_NO_SSL3
case OPT_SSL3:
- meth = SSLv3_client_method();
+ meth = SSLv3_server_method();
break;
#endif
case OPT_TLS1_2:
- meth = TLSv1_2_client_method();
+ meth = TLSv1_2_server_method();
break;
case OPT_TLS1_1:
- meth = TLSv1_1_client_method();
+ meth = TLSv1_1_server_method();
break;
case OPT_TLS1:
- meth = TLSv1_client_method();
+ meth = TLSv1_server_method();
break;
#ifndef OPENSSL_NO_DTLS1
case OPT_DTLS:
- meth = DTLS_client_method();
+ meth = DTLS_server_method();
socket_type = SOCK_DGRAM;
break;
case OPT_DTLS1:
- meth = DTLSv1_client_method();
+ meth = DTLSv1_server_method();
socket_type = SOCK_DGRAM;
break;
case OPT_DTLS1_2:
- meth = DTLSv1_2_client_method();
+ meth = DTLSv1_2_server_method();
socket_type = SOCK_DGRAM;
break;
case OPT_TIMEOUT:
EVP_PKEY_free(s_dkey);
sk_X509_pop_free(s_chain, X509_free);
sk_X509_pop_free(s_dchain, X509_free);
- if (pass)
- OPENSSL_free(pass);
- if (dpass)
- OPENSSL_free(dpass);
+ OPENSSL_free(pass);
+ OPENSSL_free(dpass);
X509_VERIFY_PARAM_free(vpm);
free_sessions();
#ifndef OPENSSL_NO_TLSEXT
- if (tlscstatp.host)
- OPENSSL_free(tlscstatp.host);
- if (tlscstatp.port)
- OPENSSL_free(tlscstatp.port);
- if (tlscstatp.path)
- OPENSSL_free(tlscstatp.path);
- if (ctx2 != NULL)
+ OPENSSL_free(tlscstatp.host);
+ OPENSSL_free(tlscstatp.port);
+ OPENSSL_free(tlscstatp.path);
SSL_CTX_free(ctx2);
X509_free(s_cert2);
EVP_PKEY_free(s_key2);
BIO_free(serverinfo_in);
# ifndef OPENSSL_NO_NEXTPROTONEG
- if (next_proto.data)
- OPENSSL_free(next_proto.data);
+ OPENSSL_free(next_proto.data);
# endif
- if (alpn_ctx.data)
- OPENSSL_free(alpn_ctx.data);
+ OPENSSL_free(alpn_ctx.data);
#endif
ssl_excert_free(exc);
sk_OPENSSL_STRING_free(ssl_args);
SSL_CONF_CTX_free(cctx);
-#ifndef OPENSSL_NO_JPAKE
- if (jpake_secret && psk_key)
- OPENSSL_free(psk_key);
-#endif
BIO_free(bio_s_out);
bio_s_out = NULL;
BIO_free(bio_s_msg);
err:
if (ret >= 0)
BIO_printf(bio_s_out, "ACCEPT\n");
- if (buf != NULL)
- OPENSSL_free(buf);
+ OPENSSL_free(buf);
BIO_free_all(io);
return (ret);
}
p--;
i--;
}
- if (!s_ign_eof && i == 5 && !strncmp(buf, "CLOSE", 5)) {
+ if (!s_ign_eof && (i == 5) && (strncmp(buf, "CLOSE", 5) == 0)) {
ret = 1;
BIO_printf(bio_err, "CONNECTION CLOSED\n");
goto end;
err:
- if (buf != NULL)
- OPENSSL_free(buf);
+ OPENSSL_free(buf);
BIO_free_all(io);
return (ret);
}
static int add_session(SSL *ssl, SSL_SESSION *session)
{
- simple_ssl_session *sess = app_malloc(sizeof *sess, "get session");
+ simple_ssl_session *sess = app_malloc(sizeof(*sess), "get session");
unsigned char *p;
SSL_SESSION_get_id(session, &sess->idlen);