Remember to release certs.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18472 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-10-16 09:50:49 +00:00
parent b13d4aa75d
commit ead04d2e0e
2 changed files with 15 additions and 9 deletions

View File

@@ -740,12 +740,9 @@ collect_cert(struct p11_module *p, struct p11_slot *slot,
} }
ret = _hx509_collector_certs_add(ctx->context, ctx->c, cert); ret = _hx509_collector_certs_add(ctx->context, ctx->c, cert);
if (ret) { hx509_cert_free(cert);
hx509_cert_free(cert);
return ret;
}
return 0; return ret;
} }
@@ -967,8 +964,6 @@ p11_release_module(struct p11_module *p)
; ;
} }
if (p->slot[i].certs)
hx509_certs_free(&p->slot[i].certs);
if (p->slot[i].name) if (p->slot[i].name)
free(p->slot[i].name); free(p->slot[i].name);
if (p->slot[i].pin) { if (p->slot[i].pin) {
@@ -1002,7 +997,14 @@ p11_release_module(struct p11_module *p)
static int static int
p11_free(hx509_certs certs, void *data) p11_free(hx509_certs certs, void *data)
{ {
p11_release_module((struct p11_module *)data); struct p11_module *p = data;
int i;
for (i = 0; i < p->num_slots; i++) {
if (p->slot[i].certs)
hx509_certs_free(&p->slot[i].certs);
}
p11_release_module(p);
return 0; return 0;
} }

View File

@@ -164,9 +164,13 @@ certBag_parser(hx509_context context,
const heim_oid *oid = (*(oids[i]))(); const heim_oid *oid = (*(oids[i]))();
attr = find_attribute(attrs, oid); attr = find_attribute(attrs, oid);
if (attr) if (attr)
_hx509_set_cert_attribute(context, cert, oid, &attr->attrValues); _hx509_set_cert_attribute(context, cert, oid,
&attr->attrValues);
} }
} }
hx509_cert_free(cert);
return 0; return 0;
} }