Make a few variable names saner.

Change-Id: I6790dc9651dc400992fc59a4c900210edeb2520c
Reviewed-on: https://boringssl-review.googlesource.com/4511
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/ec/wnaf.c b/crypto/ec/wnaf.c
index b6d1a54..0beee2f 100644
--- a/crypto/ec/wnaf.c
+++ b/crypto/ec/wnaf.c
@@ -121,14 +121,8 @@
 }
 
 void ec_pre_comp_free(EC_PRE_COMP *pre_comp) {
-  int i;
-
-  if (!pre_comp) {
-    return;
-  }
-
-  i = CRYPTO_add(&pre_comp->references, -1, CRYPTO_LOCK_EC_PRE_COMP);
-  if (i > 0) {
+  if (pre_comp == NULL ||
+      CRYPTO_add(&pre_comp->references, -1, CRYPTO_LOCK_EC_PRE_COMP) > 0) {
     return;
   }
 
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index 038a2f2..348c7a8 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -1870,20 +1870,14 @@
   return NULL;
 }
 
-void SSL_CTX_free(SSL_CTX *a) {
-  int i;
-
-  if (a == NULL) {
+void SSL_CTX_free(SSL_CTX *ctx) {
+  if (ctx == NULL ||
+      CRYPTO_add(&ctx->references, -1, CRYPTO_LOCK_SSL_CTX) > 0) {
     return;
   }
 
-  i = CRYPTO_add(&a->references, -1, CRYPTO_LOCK_SSL_CTX);
-  if (i > 0) {
-    return;
-  }
-
-  if (a->param) {
-    X509_VERIFY_PARAM_free(a->param);
+  if (ctx->param) {
+    X509_VERIFY_PARAM_free(ctx->param);
   }
 
   /* Free internal session cache. However: the remove_cb() may reference the
@@ -1892,59 +1886,59 @@
    * the session cache, the most secure solution seems to be: empty (flush) the
    * cache, then free ex_data, then finally free the cache. (See ticket
    * [openssl.org #212].) */
-  if (a->sessions != NULL) {
-    SSL_CTX_flush_sessions(a, 0);
+  if (ctx->sessions != NULL) {
+    SSL_CTX_flush_sessions(ctx, 0);
   }
 
-  CRYPTO_free_ex_data(&g_ex_data_class_ssl_ctx, a, &a->ex_data);
+  CRYPTO_free_ex_data(&g_ex_data_class_ssl_ctx, ctx, &ctx->ex_data);
 
-  if (a->sessions != NULL) {
-    lh_SSL_SESSION_free(a->sessions);
+  if (ctx->sessions != NULL) {
+    lh_SSL_SESSION_free(ctx->sessions);
   }
-  if (a->cert_store != NULL) {
-    X509_STORE_free(a->cert_store);
+  if (ctx->cert_store != NULL) {
+    X509_STORE_free(ctx->cert_store);
   }
-  if (a->cipher_list != NULL) {
-    ssl_cipher_preference_list_free(a->cipher_list);
+  if (ctx->cipher_list != NULL) {
+    ssl_cipher_preference_list_free(ctx->cipher_list);
   }
-  if (a->cipher_list_by_id != NULL) {
-    sk_SSL_CIPHER_free(a->cipher_list_by_id);
+  if (ctx->cipher_list_by_id != NULL) {
+    sk_SSL_CIPHER_free(ctx->cipher_list_by_id);
   }
-  if (a->cipher_list_tls11 != NULL) {
-    ssl_cipher_preference_list_free(a->cipher_list_tls11);
+  if (ctx->cipher_list_tls11 != NULL) {
+    ssl_cipher_preference_list_free(ctx->cipher_list_tls11);
   }
-  if (a->cert != NULL) {
-    ssl_cert_free(a->cert);
+  if (ctx->cert != NULL) {
+    ssl_cert_free(ctx->cert);
   }
-  if (a->client_CA != NULL) {
-    sk_X509_NAME_pop_free(a->client_CA, X509_NAME_free);
+  if (ctx->client_CA != NULL) {
+    sk_X509_NAME_pop_free(ctx->client_CA, X509_NAME_free);
   }
-  if (a->extra_certs != NULL) {
-    sk_X509_pop_free(a->extra_certs, X509_free);
+  if (ctx->extra_certs != NULL) {
+    sk_X509_pop_free(ctx->extra_certs, X509_free);
   }
-  if (a->srtp_profiles) {
-    sk_SRTP_PROTECTION_PROFILE_free(a->srtp_profiles);
+  if (ctx->srtp_profiles) {
+    sk_SRTP_PROTECTION_PROFILE_free(ctx->srtp_profiles);
   }
-  if (a->psk_identity_hint) {
-    OPENSSL_free(a->psk_identity_hint);
+  if (ctx->psk_identity_hint) {
+    OPENSSL_free(ctx->psk_identity_hint);
   }
-  if (a->tlsext_ecpointformatlist) {
-    OPENSSL_free(a->tlsext_ecpointformatlist);
+  if (ctx->tlsext_ecpointformatlist) {
+    OPENSSL_free(ctx->tlsext_ecpointformatlist);
   }
-  if (a->tlsext_ellipticcurvelist) {
-    OPENSSL_free(a->tlsext_ellipticcurvelist);
+  if (ctx->tlsext_ellipticcurvelist) {
+    OPENSSL_free(ctx->tlsext_ellipticcurvelist);
   }
-  if (a->alpn_client_proto_list != NULL) {
-    OPENSSL_free(a->alpn_client_proto_list);
+  if (ctx->alpn_client_proto_list != NULL) {
+    OPENSSL_free(ctx->alpn_client_proto_list);
   }
-  if (a->tlsext_channel_id_private) {
-    EVP_PKEY_free(a->tlsext_channel_id_private);
+  if (ctx->tlsext_channel_id_private) {
+    EVP_PKEY_free(ctx->tlsext_channel_id_private);
   }
-  if (a->keylog_bio) {
-    BIO_free(a->keylog_bio);
+  if (ctx->keylog_bio) {
+    BIO_free(ctx->keylog_bio);
   }
 
-  OPENSSL_free(a);
+  OPENSSL_free(ctx);
 }
 
 void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb) {
diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c
index 4db1f03..75cc41f 100644
--- a/ssl/ssl_sess.c
+++ b/ssl/ssl_sess.c
@@ -616,45 +616,39 @@
   return session;
 }
 
-void SSL_SESSION_free(SSL_SESSION *ss) {
-  int i;
-
-  if (ss == NULL) {
+void SSL_SESSION_free(SSL_SESSION *session) {
+  if (session == NULL ||
+      CRYPTO_add(&session->references, -1, CRYPTO_LOCK_SSL_SESSION) > 0) {
     return;
   }
 
-  i = CRYPTO_add(&ss->references, -1, CRYPTO_LOCK_SSL_SESSION);
-  if (i > 0) {
-    return;
-  }
+  CRYPTO_free_ex_data(&g_ex_data_class, session, &session->ex_data);
 
-  CRYPTO_free_ex_data(&g_ex_data_class, ss, &ss->ex_data);
-
-  OPENSSL_cleanse(ss->master_key, sizeof ss->master_key);
-  OPENSSL_cleanse(ss->session_id, sizeof ss->session_id);
-  if (ss->sess_cert != NULL) {
-    ssl_sess_cert_free(ss->sess_cert);
+  OPENSSL_cleanse(session->master_key, sizeof(session->master_key));
+  OPENSSL_cleanse(session->session_id, sizeof(session->session_id));
+  if (session->sess_cert != NULL) {
+    ssl_sess_cert_free(session->sess_cert);
   }
-  if (ss->peer != NULL) {
-    X509_free(ss->peer);
+  if (session->peer != NULL) {
+    X509_free(session->peer);
   }
-  if (ss->tlsext_hostname != NULL) {
-    OPENSSL_free(ss->tlsext_hostname);
+  if (session->tlsext_hostname != NULL) {
+    OPENSSL_free(session->tlsext_hostname);
   }
-  if (ss->tlsext_tick != NULL) {
-    OPENSSL_free(ss->tlsext_tick);
+  if (session->tlsext_tick != NULL) {
+    OPENSSL_free(session->tlsext_tick);
   }
-  if (ss->tlsext_signed_cert_timestamp_list != NULL) {
-    OPENSSL_free(ss->tlsext_signed_cert_timestamp_list);
+  if (session->tlsext_signed_cert_timestamp_list != NULL) {
+    OPENSSL_free(session->tlsext_signed_cert_timestamp_list);
   }
-  if (ss->ocsp_response != NULL) {
-    OPENSSL_free(ss->ocsp_response);
+  if (session->ocsp_response != NULL) {
+    OPENSSL_free(session->ocsp_response);
   }
-  if (ss->psk_identity != NULL) {
-    OPENSSL_free(ss->psk_identity);
+  if (session->psk_identity != NULL) {
+    OPENSSL_free(session->psk_identity);
   }
-  OPENSSL_cleanse(ss, sizeof(*ss));
-  OPENSSL_free(ss);
+  OPENSSL_cleanse(session, sizeof(*session));
+  OPENSSL_free(session);
 }
 
 int SSL_set_session(SSL *s, SSL_SESSION *session) {