From: Ian Jackson Date: Sun, 6 Oct 2019 21:12:06 +0000 (+0100) Subject: rsa1: rsa_loadpriv_core: Make assume_valid do the frees X-Git-Tag: v0.6.0~178 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=secnet.git;a=commitdiff_plain;h=dffca6e2220c60519e52ac03438f37a0aa513293 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 --- 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; }