diff options
author | David Benjamin <davidben@chromium.org> | 2015-12-11 23:29:17 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-12-17 00:17:09 +0300 |
commit | 2936170d68ec617e1e6f0c2def86728ba29312b7 (patch) | |
tree | 6d60fa3e98ca2ecf513ba7733be8f4c39aa14c20 /crypto/dsa | |
parent | a01deee96b1c9a28ff7d09ac6bcc75b91171b458 (diff) |
Fix memory leak in DSA redo case.
Found by clang scan-build.
Change-Id: I44a9d5ea165ede836c72aed8725d0bb0981b1004
Reviewed-on: https://boringssl-review.googlesource.com/6700
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/dsa')
-rw-r--r-- | crypto/dsa/dsa.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crypto/dsa/dsa.c b/crypto/dsa/dsa.c index 5bf031e1..ebe55e84 100644 --- a/crypto/dsa/dsa.c +++ b/crypto/dsa/dsa.c @@ -536,10 +536,6 @@ redo: 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. */ if (BN_is_zero(r) || BN_is_zero(s)) { @@ -549,11 +545,15 @@ redo: } goto redo; } + ret = DSA_SIG_new(); + if (ret == NULL) { + goto err; + } ret->r = r; ret->s = s; err: - if (!ret) { + if (ret == NULL) { OPENSSL_PUT_ERROR(DSA, reason); BN_free(r); BN_free(s); |