From 029fec2038d1611f69fabd65bd2ee3fa28712fe7 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 6 Oct 2019 22:12:06 +0100 Subject: [PATCH] rsa1: rsa_loadpriv_core: Make assume_valid do the frees 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 --- rsa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rsa.c b/rsa.c index fa4037d..790f7cc 100644 --- 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; } -- 2.30.2