diff options
author | jsing <> | 2014-05-28 13:03:25 +0000 |
---|---|---|
committer | jsing <> | 2014-05-28 13:03:25 +0000 |
commit | 1904ce01988b6ea0f5775507b4d812459c5b3f50 (patch) | |
tree | 60af46eb8cb0fcb0e51840739e416c98c124d73c /src/lib/libssl/ssl_lib.c | |
parent | 60cd1d60f58b32225afb881559d08dbc68a2eb79 (diff) | |
download | openbsd-1904ce01988b6ea0f5775507b4d812459c5b3f50.tar.gz openbsd-1904ce01988b6ea0f5775507b4d812459c5b3f50.tar.bz2 openbsd-1904ce01988b6ea0f5775507b4d812459c5b3f50.zip |
There is no point in checking if a pointer is non-NULL before calling free,
since free already does this for us. Also remove some pointless NULL
assignments, where the result from malloc(3) is immediately assigned to the
same variable.
ok miod@
Diffstat (limited to 'src/lib/libssl/ssl_lib.c')
-rw-r--r-- | src/lib/libssl/ssl_lib.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index e607060d42..bf98354294 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
@@ -549,25 +549,20 @@ SSL_free(SSL *s) | |||
549 | /* Free up if allocated */ | 549 | /* Free up if allocated */ |
550 | 550 | ||
551 | #ifndef OPENSSL_NO_TLSEXT | 551 | #ifndef OPENSSL_NO_TLSEXT |
552 | if (s->tlsext_hostname) | 552 | free(s->tlsext_hostname); |
553 | free(s->tlsext_hostname); | ||
554 | if (s->initial_ctx) | 553 | if (s->initial_ctx) |
555 | SSL_CTX_free(s->initial_ctx); | 554 | SSL_CTX_free(s->initial_ctx); |
556 | #ifndef OPENSSL_NO_EC | 555 | #ifndef OPENSSL_NO_EC |
557 | if (s->tlsext_ecpointformatlist) | 556 | free(s->tlsext_ecpointformatlist); |
558 | free(s->tlsext_ecpointformatlist); | 557 | free(s->tlsext_ellipticcurvelist); |
559 | if (s->tlsext_ellipticcurvelist) | ||
560 | free(s->tlsext_ellipticcurvelist); | ||
561 | #endif /* OPENSSL_NO_EC */ | 558 | #endif /* OPENSSL_NO_EC */ |
562 | if (s->tlsext_opaque_prf_input) | 559 | free(s->tlsext_opaque_prf_input); |
563 | free(s->tlsext_opaque_prf_input); | ||
564 | if (s->tlsext_ocsp_exts) | 560 | if (s->tlsext_ocsp_exts) |
565 | sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts, | 561 | sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts, |
566 | X509_EXTENSION_free); | 562 | X509_EXTENSION_free); |
567 | if (s->tlsext_ocsp_ids) | 563 | if (s->tlsext_ocsp_ids) |
568 | sk_OCSP_RESPID_pop_free(s->tlsext_ocsp_ids, OCSP_RESPID_free); | 564 | sk_OCSP_RESPID_pop_free(s->tlsext_ocsp_ids, OCSP_RESPID_free); |
569 | if (s->tlsext_ocsp_resp) | 565 | free(s->tlsext_ocsp_resp); |
570 | free(s->tlsext_ocsp_resp); | ||
571 | #endif | 566 | #endif |
572 | 567 | ||
573 | if (s->client_CA != NULL) | 568 | if (s->client_CA != NULL) |
@@ -581,8 +576,7 @@ SSL_free(SSL *s) | |||
581 | 576 | ||
582 | 577 | ||
583 | #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) | 578 | #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) |
584 | if (s->next_proto_negotiated) | 579 | free(s->next_proto_negotiated); |
585 | free(s->next_proto_negotiated); | ||
586 | #endif | 580 | #endif |
587 | 581 | ||
588 | #ifndef OPENSSL_NO_SRTP | 582 | #ifndef OPENSSL_NO_SRTP |
@@ -1893,7 +1887,8 @@ SSL_CTX_new(const SSL_METHOD *meth) | |||
1893 | #if 0 | 1887 | #if 0 |
1894 | static void | 1888 | static void |
1895 | SSL_COMP_free(SSL_COMP *comp) | 1889 | SSL_COMP_free(SSL_COMP *comp) |
1896 | { free(comp); | 1890 | { |
1891 | free(comp); | ||
1897 | } | 1892 | } |
1898 | #endif | 1893 | #endif |
1899 | 1894 | ||
@@ -1954,8 +1949,7 @@ SSL_CTX_free(SSL_CTX *a) | |||
1954 | #endif | 1949 | #endif |
1955 | 1950 | ||
1956 | #ifndef OPENSSL_NO_PSK | 1951 | #ifndef OPENSSL_NO_PSK |
1957 | if (a->psk_identity_hint) | 1952 | free(a->psk_identity_hint); |
1958 | free(a->psk_identity_hint); | ||
1959 | #endif | 1953 | #endif |
1960 | #ifndef OPENSSL_NO_ENGINE | 1954 | #ifndef OPENSSL_NO_ENGINE |
1961 | if (a->client_cert_engine) | 1955 | if (a->client_cert_engine) |
@@ -3129,8 +3123,7 @@ SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint) | |||
3129 | SSL_R_DATA_LENGTH_TOO_LONG); | 3123 | SSL_R_DATA_LENGTH_TOO_LONG); |
3130 | return (0); | 3124 | return (0); |
3131 | } | 3125 | } |
3132 | if (ctx->psk_identity_hint != NULL) | 3126 | free(ctx->psk_identity_hint); |
3133 | free(ctx->psk_identity_hint); | ||
3134 | if (identity_hint != NULL) { | 3127 | if (identity_hint != NULL) { |
3135 | ctx->psk_identity_hint = BUF_strdup(identity_hint); | 3128 | ctx->psk_identity_hint = BUF_strdup(identity_hint); |
3136 | if (ctx->psk_identity_hint == NULL) | 3129 | if (ctx->psk_identity_hint == NULL) |
@@ -3155,8 +3148,7 @@ SSL_use_psk_identity_hint(SSL *s, const char *identity_hint) | |||
3155 | SSL_R_DATA_LENGTH_TOO_LONG); | 3148 | SSL_R_DATA_LENGTH_TOO_LONG); |
3156 | return (0); | 3149 | return (0); |
3157 | } | 3150 | } |
3158 | if (s->session->psk_identity_hint != NULL) | 3151 | free(s->session->psk_identity_hint); |
3159 | free(s->session->psk_identity_hint); | ||
3160 | if (identity_hint != NULL) { | 3152 | if (identity_hint != NULL) { |
3161 | s->session->psk_identity_hint = BUF_strdup(identity_hint); | 3153 | s->session->psk_identity_hint = BUF_strdup(identity_hint); |
3162 | if (s->session->psk_identity_hint == NULL) | 3154 | if (s->session->psk_identity_hint == NULL) |