summaryrefslogtreecommitdiff
path: root/usr.sbin/rpki-client
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2024-01-31 06:48:28 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2024-01-31 06:48:28 +0000
commit87fc41cf03d7f59869d5e0c35e99c736d30a0079 (patch)
tree9228b1572d2010782d610746eabc52c963f26e1a /usr.sbin/rpki-client
parent6d790f055651d508e5ec6bf1f850fab4a3ba6f9f (diff)
proc_parser_mft_pre: move freeing into an error path
Simplifies subsequent commits which will use the same exit path. ok job
Diffstat (limited to 'usr.sbin/rpki-client')
-rw-r--r--usr.sbin/rpki-client/parser.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/usr.sbin/rpki-client/parser.c b/usr.sbin/rpki-client/parser.c
index 9ba655336bd..f8e4f95d163 100644
--- a/usr.sbin/rpki-client/parser.c
+++ b/usr.sbin/rpki-client/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.109 2024/01/31 06:46:31 tb Exp $ */
+/* $OpenBSD: parser.c,v 1.110 2024/01/31 06:48:27 tb Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -293,21 +293,24 @@ proc_parser_mft_pre(struct entity *entp, enum location loc, char **file,
*crl = parse_load_crl_from_mft(entp, mft, DIR_VALID, crlfile);
a = valid_ski_aki(*file, &auths, mft->ski, mft->aki, NULL);
- if (!valid_x509(*file, ctx, x509, a, *crl, errstr)) {
- X509_free(x509);
- mft_free(mft);
- crl_free(*crl);
- *crl = NULL;
- free(*crlfile);
- *crlfile = NULL;
- return NULL;
- }
+ if (!valid_x509(*file, ctx, x509, a, *crl, errstr))
+ goto err;
X509_free(x509);
+ x509 = NULL;
mft->repoid = entp->repoid;
mft->talid = a->cert->talid;
return mft;
+
+ err:
+ X509_free(x509);
+ mft_free(mft);
+ crl_free(*crl);
+ *crl = NULL;
+ free(*crlfile);
+ *crlfile = NULL;
+ return NULL;
}
/*