summaryrefslogtreecommitdiffstats
path: root/lib/keychain.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:34 +0000
commit137ce8dd46d313f15ee93ddbb5428d702aa61ed8 (patch)
treea49f76849019651842962dff2197b705e33831e7 /lib/keychain.c
parentReleasing progress-linux version 9.1-0.1~progress7.99u1. (diff)
downloadfrr-137ce8dd46d313f15ee93ddbb5428d702aa61ed8.tar.xz
frr-137ce8dd46d313f15ee93ddbb5428d702aa61ed8.zip
Merging upstream version 10.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--lib/keychain.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/keychain.c b/lib/keychain.c
index 640746b..5ff0d1e 100644
--- a/lib/keychain.c
+++ b/lib/keychain.c
@@ -37,6 +37,7 @@ static void keychain_free(struct keychain *keychain)
static struct key *key_new(void)
{
struct key *key = XCALLOC(MTYPE_KEY, sizeof(struct key));
+
QOBJ_REG(key, key);
return key;
}
@@ -77,7 +78,7 @@ static int key_cmp_func(void *arg1, void *arg2)
static void key_delete_func(struct key *key)
{
if (key->string)
- free(key->string);
+ XFREE(MTYPE_KEY, key->string);
key_free(key);
}
@@ -1187,6 +1188,20 @@ static const struct cmd_variable_handler keychain_var_handlers[] = {
{.completions = NULL}
};
+void keychain_terminate(void)
+{
+ struct keychain *keychain;
+
+ while (listcount(keychain_list)) {
+ keychain = listgetdata(listhead(keychain_list));
+
+ listnode_delete(keychain_list, keychain);
+ keychain_delete(keychain);
+ }
+
+ list_delete(&keychain_list);
+}
+
void keychain_init(void)
{
keychain_list = list_new();