Remove unnecessary NULL checks, part 5.
Finally, the ssl stack.
Change-Id: Iea10e302825947da36ad46eaf3e8e2bce060fde2
Reviewed-on: https://boringssl-review.googlesource.com/4518
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/ssl_cipher.c b/ssl/ssl_cipher.c
index 857b2a4..7e0ade8 100644
--- a/ssl/ssl_cipher.c
+++ b/ssl/ssl_cipher.c
@@ -1003,9 +1003,7 @@
pref_list = NULL;
if (out_cipher_list_by_id != NULL) {
- if (*out_cipher_list_by_id != NULL) {
- sk_SSL_CIPHER_free(*out_cipher_list_by_id);
- }
+ sk_SSL_CIPHER_free(*out_cipher_list_by_id);
*out_cipher_list_by_id = tmp_cipher_list;
tmp_cipher_list = NULL;
(void) sk_SSL_CIPHER_set_cmp_func(*out_cipher_list_by_id,
@@ -1020,24 +1018,14 @@
return cipherstack;
err:
- if (co_list) {
- OPENSSL_free(co_list);
- }
- if (in_group_flags) {
- OPENSSL_free(in_group_flags);
- }
- if (cipherstack) {
- sk_SSL_CIPHER_free(cipherstack);
- }
- if (tmp_cipher_list) {
- sk_SSL_CIPHER_free(tmp_cipher_list);
- }
- if (pref_list && pref_list->in_group_flags) {
+ OPENSSL_free(co_list);
+ OPENSSL_free(in_group_flags);
+ sk_SSL_CIPHER_free(cipherstack);
+ sk_SSL_CIPHER_free(tmp_cipher_list);
+ if (pref_list) {
OPENSSL_free(pref_list->in_group_flags);
}
- if (pref_list) {
- OPENSSL_free(pref_list);
- }
+ OPENSSL_free(pref_list);
return NULL;
}