From e90f1d9b74275c11e3492e521e46f4b1afa6f883 Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Thu, 8 Oct 2015 14:38:57 +0200 Subject: Fix memory leaks and other mistakes on errors Reviewed-by: Rich Salz Reviewed-by: Richard Levitte (cherry picked from commit 3f6c7691870d1cd2ad0e0c83638cef3f35a0b548) --- crypto/dsa/dsa_gen.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crypto/dsa') diff --git a/crypto/dsa/dsa_gen.c b/crypto/dsa/dsa_gen.c index 6bc86dd57e..1256a8e2a2 100644 --- a/crypto/dsa/dsa_gen.c +++ b/crypto/dsa/dsa_gen.c @@ -176,14 +176,14 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, if (seed_in != NULL) memcpy(seed, seed_in, seed_len); + if ((mont = BN_MONT_CTX_new()) == NULL) + goto err; + if ((ctx = BN_CTX_new()) == NULL) goto err; BN_CTX_start(ctx); - if ((mont = BN_MONT_CTX_new()) == NULL) - goto err; - r0 = BN_CTX_get(ctx); g = BN_CTX_get(ctx); W = BN_CTX_get(ctx); -- cgit v1.2.3