diff options
| author | jsing <> | 2017-01-24 15:11:55 +0000 |
|---|---|---|
| committer | jsing <> | 2017-01-24 15:11:55 +0000 |
| commit | f904ac28f392ed05533f54c6bfb0398c62dcb37d (patch) | |
| tree | dfdca4ac3bd4e7d5ce863e090dd20086228c7162 /src/lib/libssl/ssl_lib.c | |
| parent | a5881c323420e24efe94dede93a9f8fafc24b3b1 (diff) | |
| download | openbsd-f904ac28f392ed05533f54c6bfb0398c62dcb37d.tar.gz openbsd-f904ac28f392ed05533f54c6bfb0398c62dcb37d.tar.bz2 openbsd-f904ac28f392ed05533f54c6bfb0398c62dcb37d.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/lib/libssl/ssl_lib.c')
| -rw-r--r-- | src/lib/libssl/ssl_lib.c | 20 |
1 files changed, 7 insertions, 13 deletions
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 | ||
