Try to not leak memory.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18786 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-10-21 20:12:42 +00:00
parent 1860dc7db2
commit df5da7edfe
2 changed files with 9 additions and 2 deletions

View File

@@ -129,6 +129,7 @@ hx509_context_set_missing_revoke(hx509_context context, int flag)
void
hx509_context_free(hx509_context *context)
{
hx509_clear_error_string(*context);
if ((*context)->ks_ops) {
free((*context)->ks_ops);
(*context)->ks_ops = NULL;
@@ -204,12 +205,11 @@ hx509_cert_init(hx509_context context, const Certificate *c, hx509_cert *cert)
(*cert)->release = NULL;
(*cert)->ctx = NULL;
(*cert)->data = malloc(sizeof(*(*cert)->data));
(*cert)->data = calloc(1, sizeof(*(*cert)->data));
if ((*cert)->data == NULL) {
free(*cert);
return ENOMEM;
}
memset((*cert)->data, 0, sizeof(*(*cert)->data));
ret = copy_Certificate(c, (*cert)->data);
if (ret) {
free((*cert)->data);