From 146f753987cd660fbdd7e0b246315667ab2dd479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Sun, 29 Mar 2009 09:01:47 +0000 Subject: [PATCH] make attach release the keyset git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24982 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/hx509/cert.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/hx509/cert.c b/lib/hx509/cert.c index 9498735a7..19136b345 100644 --- a/lib/hx509/cert.c +++ b/lib/hx509/cert.c @@ -432,6 +432,7 @@ hx509_verify_destroy_ctx(hx509_verify_ctx ctx) * Set the trust anchors in the verification context, makes an * reference to the keyset, so the consumer can free the keyset * independent of the destruction of the verification context (ctx). + * If there already is a keyset attached, it's released. * * @param ctx a verification context * @param set a keyset containing the trust anchors. @@ -442,6 +443,8 @@ hx509_verify_destroy_ctx(hx509_verify_ctx ctx) void hx509_verify_attach_anchors(hx509_verify_ctx ctx, hx509_certs set) { + if (ctx->trust_anchors) + hx509_certs_free(ctx, ctx->trust_anchors); ctx->trust_anchors = _hx509_certs_ref(set); }