1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00
putty-source/utils/host_ca_new_free.c
Simon Tatham e34e0220ab Centralise creation of a host_ca structure.
This will allow the central host_ca_new function to pre-populate the
structure with default values for the fields, so that once I add more
options to CA configuration they can take their default values when
loading a saved record from a previous PuTTY version.
2022-05-02 11:07:28 +01:00

22 lines
455 B
C

#include "defs.h"
#include "misc.h"
#include "storage.h"
host_ca *host_ca_new(void)
{
host_ca *hca = snew(host_ca);
memset(hca, 0, sizeof(*hca));
return hca;
}
void host_ca_free(host_ca *hca)
{
sfree(hca->name);
if (hca->ca_public_key)
strbuf_free(hca->ca_public_key);
for (size_t i = 0; i < hca->n_hostname_wildcards; i++)
sfree(hca->hostname_wildcards[i]);
sfree(hca->hostname_wildcards);
sfree(hca);
}