You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2014/06/19 17:09:15 UTC

svn commit: r1603915 - /httpd/httpd/trunk/modules/ssl/ssl_engine_init.c

Author: jorton
Date: Thu Jun 19 15:09:15 2014
New Revision: 1603915

URL: http://svn.apache.org/r1603915
Log:
* modules/ssl/ssl_engine_init.c (make_dh_params): Remove redundant
  temporary variable; no functional change.
  (free_dh_params): Add comment.

Submitted by: rpluem, jorton

Modified:
    httpd/httpd/trunk/modules/ssl/ssl_engine_init.c

Modified: httpd/httpd/trunk/modules/ssl/ssl_engine_init.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_engine_init.c?rev=1603915&r1=1603914&r2=1603915&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_engine_init.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_engine_init.c Thu Jun 19 15:09:15 2014
@@ -53,22 +53,17 @@ APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ssl,
  */
 static DH *make_dh_params(BIGNUM *(*prime)(BIGNUM *), const char *gen)
 {
-    DH *dh = NULL;
-    DH *dh_tmp;
+    DH *dh = DH_new();
 
-    if (dh) {
-        return dh;
-    }
-    if (!(dh_tmp = DH_new())) {
+    if (!dh) {
         return NULL;
     }
-    dh_tmp->p = prime(NULL);
-    BN_dec2bn(&dh_tmp->g, gen);
-    if (!dh_tmp->p || !dh_tmp->g) {
-        DH_free(dh_tmp);
+    dh->p = prime(NULL);
+    BN_dec2bn(&dh->g, gen);
+    if (!dh->p || !dh->g) {
+        DH_free(dh);
         return NULL;
     }
-    dh = dh_tmp;
     return dh;
 }
 
@@ -87,6 +82,9 @@ static void init_dh_params(void)
 
 static void free_dh_params(void)
 {
+    /* DH_free() is a noop for a NULL parameter, so these are harmless
+     * in the (unexpected) case where these variables are already
+     * NULL. */
     DH_free(dhparam1024);
     DH_free(dhparam2048);
     DH_free(dhparam3072);