(_hx509_revoke_ref): new function.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22214 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -52,6 +52,7 @@ struct revoke_ocsp {
|
|||||||
|
|
||||||
|
|
||||||
struct hx509_revoke_ctx_data {
|
struct hx509_revoke_ctx_data {
|
||||||
|
unsigned ref;
|
||||||
struct {
|
struct {
|
||||||
struct revoke_crl *val;
|
struct revoke_crl *val;
|
||||||
size_t len;
|
size_t len;
|
||||||
@@ -69,6 +70,7 @@ hx509_revoke_init(hx509_context context, hx509_revoke_ctx *ctx)
|
|||||||
if (*ctx == NULL)
|
if (*ctx == NULL)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
|
||||||
|
(*ctx)->ref = 1;
|
||||||
(*ctx)->crls.len = 0;
|
(*ctx)->crls.len = 0;
|
||||||
(*ctx)->crls.val = NULL;
|
(*ctx)->crls.val = NULL;
|
||||||
(*ctx)->ocsps.len = 0;
|
(*ctx)->ocsps.len = 0;
|
||||||
@@ -77,6 +79,17 @@ hx509_revoke_init(hx509_context context, hx509_revoke_ctx *ctx)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hx509_revoke_ctx
|
||||||
|
_hx509_revoke_ref(hx509_revoke_ctx ctx)
|
||||||
|
{
|
||||||
|
if (ctx->ref <= 0)
|
||||||
|
_hx509_abort("revoke ctx refcount <= 0");
|
||||||
|
ctx->ref++;
|
||||||
|
if (ctx->ref == 0)
|
||||||
|
_hx509_abort("revoke ctx refcount == 0");
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
free_ocsp(struct revoke_ocsp *ocsp)
|
free_ocsp(struct revoke_ocsp *ocsp)
|
||||||
{
|
{
|
||||||
@@ -94,6 +107,11 @@ hx509_revoke_free(hx509_revoke_ctx *ctx)
|
|||||||
if (ctx == NULL || *ctx == NULL)
|
if (ctx == NULL || *ctx == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if ((*ctx)->ref <= 0)
|
||||||
|
_hx509_abort("revoke ctx refcount <= 0 on free");
|
||||||
|
if (--(*ctx)->ref > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
for (i = 0; i < (*ctx)->crls.len; i++) {
|
for (i = 0; i < (*ctx)->crls.len; i++) {
|
||||||
free((*ctx)->crls.val[i].path);
|
free((*ctx)->crls.val[i].path);
|
||||||
free_CRLCertificateList(&(*ctx)->crls.val[i].crl);
|
free_CRLCertificateList(&(*ctx)->crls.val[i].crl);
|
||||||
|
Reference in New Issue
Block a user