chiark / gitweb /
rsa1: rsa_loadpriv_core: Make assume_valid do the frees
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Oct 2019 21:12:06 +0000 (22:12 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 15 Feb 2020 21:56:49 +0000 (21:56 +0000)
This regularises the exit path: now we always do these clears.  This
makes the function easier to think about and easier to amend in the
way we're just about to.

There is no overall functional change since these variables are
initialised with mpz_init right at the top, even on the assume_valid
path.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
rsa.c

diff --git a/rsa.c b/rsa.c
index fa4037dc75210bf0db497c827d69828b0986869c..790f7cc0a0e7513d1e3dd9324f255e55b24531b1 100644 (file)
--- a/rsa.c
+++ b/rsa.c
@@ -574,6 +574,8 @@ done_checks:
        LDFATAL("file \"%s\" does not contain a "
                 "valid RSA key!\n",filename);
     }
+
+assume_valid:
     mpz_clear(&tmp);
     mpz_clear(&tmp2);
     mpz_clear(&tmp3);
@@ -583,7 +585,6 @@ done_checks:
     mpz_clear(&d);
     mpz_clear(&iqmp);
 
-assume_valid:
     return st;
 }