(_hx509_collector_alloc): return error code instead of pointer.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20778 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2007-06-01 22:04:13 +00:00
parent 644b44dbef
commit 4481b27002

View File

@@ -51,22 +51,26 @@ struct hx509_collector {
};
struct hx509_collector *
_hx509_collector_alloc(hx509_context context, hx509_lock lock)
int
_hx509_collector_alloc(hx509_context context, hx509_lock lock, struct hx509_collector **collector)
{
struct hx509_collector *c;
int ret;
*collector = NULL;
c = calloc(1, sizeof(*c));
if (c == NULL)
return NULL;
if (c == NULL) {
hx509_set_error_string(context, 0, ENOMEM, "out of memory");
return ENOMEM;
}
c->lock = lock;
ret = hx509_certs_init(context, "MEMORY:collector-unenvelop-cert",
0,NULL, &c->unenvelop_certs);
if (ret) {
free(c);
return NULL;
return ret;
}
c->val.data = NULL;
c->val.len = 0;
@@ -75,10 +79,11 @@ _hx509_collector_alloc(hx509_context context, hx509_lock lock)
if (ret) {
hx509_certs_free(&c->unenvelop_certs);
free(c);
return NULL;
return ret;
}
return c;
*collector = c;
return 0;
}
hx509_lock