diff options
Diffstat (limited to 'pith/smkeys.c')
-rw-r--r-- | pith/smkeys.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pith/smkeys.c b/pith/smkeys.c index 415bc190..ce58ed41 100644 --- a/pith/smkeys.c +++ b/pith/smkeys.c @@ -1106,6 +1106,7 @@ mem_to_personal_certs(char *contents) pc = (PERSONAL_CERT *) fs_get(sizeof(*pc)); pc->cert = cert; pc->name = cpystr(name); + pc->cname = NULL; pc->keytext = keytext; /* a pointer into contents */ pc->key = load_key(pc, "", SM_NORMALCERT); @@ -1347,12 +1348,11 @@ void free_personal_certs(PERSONAL_CERT **pc) { if(pc && *pc){ - free_personal_certs(&(*pc)->next); if((*pc)->name) fs_give((void **) &(*pc)->name); - if((*pc)->name) - fs_give((void **) &(*pc)->name); + if((*pc)->cname) + fs_give((void **) &(*pc)->cname); if((*pc)->cert) X509_free((*pc)->cert); @@ -1360,6 +1360,8 @@ free_personal_certs(PERSONAL_CERT **pc) if((*pc)->key) EVP_PKEY_free((*pc)->key); + free_personal_certs(&(*pc)->next); + fs_give((void **) pc); } } |