diff options
author | jsing <> | 2017-01-24 15:11:55 +0000 |
---|---|---|
committer | jsing <> | 2017-01-24 15:11:55 +0000 |
commit | f968287be4f1bfa9aa3d79cadf37d5b6f6190c87 (patch) | |
tree | dfdca4ac3bd4e7d5ce863e090dd20086228c7162 /src | |
parent | fa12c318978281dc18c0d5d00a977e1b12436659 (diff) | |
download | openbsd-f968287be4f1bfa9aa3d79cadf37d5b6f6190c87.tar.gz openbsd-f968287be4f1bfa9aa3d79cadf37d5b6f6190c87.tar.bz2 openbsd-f968287be4f1bfa9aa3d79cadf37d5b6f6190c87.zip |
BUF_MEM_free(), X509_STORE_free() and X509_VERIFY_PARAM_free() all check
for NULL, as does lh_free() - do not do the same from the caller.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libssl/s3_clnt.c | 8 | ||||
-rw-r--r-- | src/lib/libssl/ssl_lib.c | 20 |
2 files changed, 10 insertions, 18 deletions
diff --git a/src/lib/libssl/s3_clnt.c b/src/lib/libssl/s3_clnt.c index ecd0f9e886..0600e7519e 100644 --- a/src/lib/libssl/s3_clnt.c +++ b/src/lib/libssl/s3_clnt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: s3_clnt.c,v 1.173 2017/01/24 15:04:12 jsing Exp $ */ | 1 | /* $OpenBSD: s3_clnt.c,v 1.174 2017/01/24 15:11:55 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -520,10 +520,8 @@ ssl3_connect(SSL *s) | |||
520 | /* clean a few things up */ | 520 | /* clean a few things up */ |
521 | tls1_cleanup_key_block(s); | 521 | tls1_cleanup_key_block(s); |
522 | 522 | ||
523 | if (s->internal->init_buf != NULL) { | 523 | BUF_MEM_free(s->internal->init_buf); |
524 | BUF_MEM_free(s->internal->init_buf); | 524 | s->internal->init_buf = NULL; |
525 | s->internal->init_buf = NULL; | ||
526 | } | ||
527 | 525 | ||
528 | /* | 526 | /* |
529 | * If we are not 'joining' the last two packets, | 527 | * If we are not 'joining' the last two packets, |
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index 3c69e66ee1..29bce5414a 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_lib.c,v 1.148 2017/01/24 15:04:12 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_lib.c,v 1.149 2017/01/24 15:11:55 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -522,8 +522,7 @@ SSL_free(SSL *s) | |||
522 | if (i > 0) | 522 | if (i > 0) |
523 | return; | 523 | return; |
524 | 524 | ||
525 | if (s->param) | 525 | X509_VERIFY_PARAM_free(s->param); |
526 | X509_VERIFY_PARAM_free(s->param); | ||
527 | 526 | ||
528 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->internal->ex_data); | 527 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->internal->ex_data); |
529 | 528 | ||
@@ -540,8 +539,7 @@ SSL_free(SSL *s) | |||
540 | BIO_free_all(s->rbio); | 539 | BIO_free_all(s->rbio); |
541 | BIO_free_all(s->wbio); | 540 | BIO_free_all(s->wbio); |
542 | 541 | ||
543 | if (s->internal->init_buf != NULL) | 542 | BUF_MEM_free(s->internal->init_buf); |
544 | BUF_MEM_free(s->internal->init_buf); | ||
545 | 543 | ||
546 | /* add extra stuff */ | 544 | /* add extra stuff */ |
547 | sk_SSL_CIPHER_free(s->cipher_list); | 545 | sk_SSL_CIPHER_free(s->cipher_list); |
@@ -1984,8 +1982,7 @@ SSL_CTX_free(SSL_CTX *ctx) | |||
1984 | if (i > 0) | 1982 | if (i > 0) |
1985 | return; | 1983 | return; |
1986 | 1984 | ||
1987 | if (ctx->param) | 1985 | X509_VERIFY_PARAM_free(ctx->param); |
1988 | X509_VERIFY_PARAM_free(ctx->param); | ||
1989 | 1986 | ||
1990 | /* | 1987 | /* |
1991 | * Free internal session cache. However: the remove_cb() may reference | 1988 | * Free internal session cache. However: the remove_cb() may reference |
@@ -2001,11 +1998,9 @@ SSL_CTX_free(SSL_CTX *ctx) | |||
2001 | 1998 | ||
2002 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, ctx, &ctx->internal->ex_data); | 1999 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, ctx, &ctx->internal->ex_data); |
2003 | 2000 | ||
2004 | if (ctx->internal->sessions != NULL) | 2001 | lh_SSL_SESSION_free(ctx->internal->sessions); |
2005 | lh_SSL_SESSION_free(ctx->internal->sessions); | ||
2006 | 2002 | ||
2007 | if (ctx->cert_store != NULL) | 2003 | X509_STORE_free(ctx->cert_store); |
2008 | X509_STORE_free(ctx->cert_store); | ||
2009 | sk_SSL_CIPHER_free(ctx->cipher_list); | 2004 | sk_SSL_CIPHER_free(ctx->cipher_list); |
2010 | sk_SSL_CIPHER_free(ctx->internal->cipher_list_by_id); | 2005 | sk_SSL_CIPHER_free(ctx->internal->cipher_list_by_id); |
2011 | ssl_cert_free(ctx->internal->cert); | 2006 | ssl_cert_free(ctx->internal->cert); |
@@ -3036,8 +3031,7 @@ SSL_CTX_get_cert_store(const SSL_CTX *ctx) | |||
3036 | void | 3031 | void |
3037 | SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store) | 3032 | SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store) |
3038 | { | 3033 | { |
3039 | if (ctx->cert_store != NULL) | 3034 | X509_STORE_free(ctx->cert_store); |
3040 | X509_STORE_free(ctx->cert_store); | ||
3041 | ctx->cert_store = store; | 3035 | ctx->cert_store = store; |
3042 | } | 3036 | } |
3043 | 3037 | ||