From: Ian Jackson Date: Sat, 7 Dec 2019 14:49:50 +0000 (+0000) Subject: privcache: Regularise error handling in missing defhash case X-Git-Tag: v0.6.0~42 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=b91db65a6fc5ea2b36bfd46bd3555f4ee77f46d5;p=secnet.git privcache: Regularise error handling in missing defhash case Now it is clearer to see that we don't leak sigpriv; Signed-off-by: Ian Jackson --- diff --git a/privcache.c b/privcache.c index c01af9d..c8a9a7f 100644 --- a/privcache.c +++ b/privcache.c @@ -118,8 +118,6 @@ static struct sigprivkey_if *uncached_load_file( slilog(log,M_ERR, "private key %s requires `hash' config key for privcache to load", path); - sigpriv->dispose(sigpriv->st); - sigpriv=0; goto error_out; } sigpriv->sethash(sigpriv->st,defhash); @@ -130,6 +128,7 @@ static struct sigprivkey_if *uncached_load_file( return ok ? sigpriv : 0; error_out: + if (sigpriv) sigpriv->dispose(sigpriv->st); ok=False; goto out; }