-/* $OpenBSD: relayd.c,v 1.140 2015/05/28 17:08:09 florian Exp $ */
+/* $OpenBSD: relayd.c,v 1.141 2015/05/30 09:47:25 claudio Exp $ */
/*
* Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org>
void
kv_free(struct kv *kv)
{
- if (kv->kv_type == KEY_TYPE_NONE)
- return;
- if (kv->kv_key != NULL) {
- free(kv->kv_key);
- }
- kv->kv_key = NULL;
- if (kv->kv_value != NULL) {
- free(kv->kv_value);
- }
- kv->kv_value = NULL;
- kv->kv_matchtree = NULL;
- kv->kv_match = NULL;
+ /*
+ * This function does not clear memory referenced by
+ * kv_children or stuff on the tailqs. Use kv_delete() instead.
+ */
+
+ free(kv->kv_key);
+ free(kv->kv_value);
memset(kv, 0, sizeof(*kv));
}