The branch master has been updated
       via  679d87515d23ca31491effdc264edc81c695a72a (commit)
      from  91cf7551a1dd4bc9a482c5577b5081adbae96ada (commit)


- Log -----------------------------------------------------------------
commit 679d87515d23ca31491effdc264edc81c695a72a
Author: David Benjamin <david...@chromium.org>
Date:   Thu Dec 17 20:11:11 2015 +0100

    Fix memory leak in DSA redo case.
    
    Found by clang scan-build.
    
    Signed-off-by: Kurt Roeckx <k...@roeckx.be>
    Reviewed-by: Richard Levitte <levi...@openssl.org>
    
    RT: #4184, MR: #1496

-----------------------------------------------------------------------

Summary of changes:
 crypto/dsa/dsa_ossl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/crypto/dsa/dsa_ossl.c b/crypto/dsa/dsa_ossl.c
index 34b4a4e..b4bb254 100644
--- a/crypto/dsa/dsa_ossl.c
+++ b/crypto/dsa/dsa_ossl.c
@@ -191,9 +191,6 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int 
dlen, DSA *dsa)
     if (!BN_mod_mul(s, s, kinv, dsa->q, ctx))
         goto err;
 
-    ret = DSA_SIG_new();
-    if (ret == NULL)
-        goto err;
     /*
      * Redo if r or s is zero as required by FIPS 186-3: this is very
      * unlikely.
@@ -205,11 +202,14 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, 
int dlen, DSA *dsa)
         }
         goto redo;
     }
+    ret = DSA_SIG_new();
+    if (ret == NULL)
+        goto err;
     ret->r = r;
     ret->s = s;
 
  err:
-    if (!ret) {
+    if (ret == NULL) {
         DSAerr(DSA_F_DSA_DO_SIGN, reason);
         BN_free(r);
         BN_free(s);
_____
openssl-commits mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits

Reply via email to