-/* $OpenBSD: cert.c,v 1.88 2022/09/03 14:40:09 job Exp $ */
+/* $OpenBSD: cert.c,v 1.89 2022/09/03 21:24:02 job Exp $ */
/*
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
* Copyright (c) 2021 Job Snijders <job@openbsd.org>
RB_GENERATE_STATIC(auth_tree, auth, entry, authcmp);
+void
+auth_tree_free(struct auth_tree *auths)
+{
+ struct auth *auth, *tauth;
+
+ RB_FOREACH_SAFE(auth, auth_tree, auths, tauth) {
+ RB_REMOVE(auth_tree, auths, auth);
+ cert_free(auth->cert);
+ free(auth);
+ }
+}
+
struct auth *
auth_find(struct auth_tree *auths, const char *aki)
{
-/* $OpenBSD: crl.c,v 1.15 2022/04/21 09:53:07 claudio Exp $ */
+/* $OpenBSD: crl.c,v 1.16 2022/09/03 21:24:02 job Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
X509_CRL_free(crl->x509_crl);
free(crl);
}
+
+void
+crl_tree_free(struct crl_tree *crlt)
+{
+ struct crl *crl, *tcrl;
+
+ RB_FOREACH_SAFE(crl, crl_tree, crlt, tcrl) {
+ RB_REMOVE(crl_tree, crlt, crl);
+ crl_free(crl);
+ }
+}
-/* $OpenBSD: extern.h,v 1.155 2022/09/03 14:40:09 job Exp $ */
+/* $OpenBSD: extern.h,v 1.156 2022/09/03 21:24:02 job Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
void cert_buffer(struct ibuf *, const struct cert *);
void cert_free(struct cert *);
+void auth_tree_free(struct auth_tree *);
struct cert *cert_parse_ee_cert(const char *, X509 *);
struct cert *cert_parse_pre(const char *, const unsigned char *, size_t);
struct cert *cert_parse(const char *, struct cert *);
struct crl *crl_get(struct crl_tree *, const struct auth *);
int crl_insert(struct crl_tree *, struct crl *);
void crl_free(struct crl *);
+void crl_tree_free(struct crl_tree *);
/* Validation of our objects. */
-/* $OpenBSD: parser.c,v 1.76 2022/09/03 13:30:27 claudio Exp $ */
+/* $OpenBSD: parser.c,v 1.77 2022/09/03 21:24:02 job Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
entity_free(entp);
}
- /* XXX free auths and crl tree */
+ auth_tree_free(&auths);
+ crl_tree_free(&crlt);
X509_STORE_CTX_free(ctx);
msgbuf_clear(&msgq);
+ ibuf_free(inbuf);
+
exit(0);
}