From 39cf2b0228b2fea6e3944a7e9b5e786e6c1c03dc Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 23 Nov 2019 13:42:05 +0000 Subject: [PATCH] rsa: Prepare rsa_loadpub_core for failure. Now the whole of st is initialised, at least well enough for dispose. We provide an error_out section which does so. Nothing uses it yet. Signed-off-by: Ian Jackson --- rsa.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rsa.c b/rsa.c index f4aad4c..e7f28b9 100644 --- a/rsa.c +++ b/rsa.c @@ -339,6 +339,7 @@ static struct rsapub *rsa_loadpub_core(RSAPUB_BNS(RSAPUB_LOADCORE_DEFBN) st->ops.hash=0; st->ops.dispose=rsapub_dispose; st->loc=overall_loc; + RSAPUB_BNS(RSAPUB_INIT_ST_BN) #define RSAPUB_LOADCORE_GETBN(ix,en,what) \ if (mpz_init_set_str(&st->en,en##s,10)!=0) { \ @@ -352,6 +353,10 @@ static struct rsapub *rsa_loadpub_core(RSAPUB_BNS(RSAPUB_LOADCORE_DEFBN) RSAPUB_BNS(RSAPUB_LOADCORE_GETBN) return st; + + error_out: + rsapub_dispose(st); + return 0; } static list_t *rsapub_apply(closure_t *self, struct cloc loc, dict_t *context, -- 2.30.2