summaryrefslogtreecommitdiff
path: root/lib/srv6.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/srv6.c')
-rw-r--r--lib/srv6.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/srv6.c b/lib/srv6.c
index ceb769ef76..ccb94b2f76 100644
--- a/lib/srv6.c
+++ b/lib/srv6.c
@@ -129,6 +129,8 @@ struct srv6_locator *srv6_locator_alloc(const char *name)
locator = XCALLOC(MTYPE_SRV6_LOCATOR, sizeof(struct srv6_locator));
strlcpy(locator->name, name, sizeof(locator->name));
locator->chunks = list_new();
+ locator->chunks->del = (void (*)(void *))srv6_locator_chunk_free;
+
QOBJ_REG(locator, srv6_locator);
return locator;
}
@@ -144,7 +146,12 @@ struct srv6_locator_chunk *srv6_locator_chunk_alloc(void)
void srv6_locator_free(struct srv6_locator *locator)
{
- XFREE(MTYPE_SRV6_LOCATOR, locator);
+ if (locator) {
+ QOBJ_UNREG(locator);
+ list_delete(&locator->chunks);
+
+ XFREE(MTYPE_SRV6_LOCATOR, locator);
+ }
}
void srv6_locator_chunk_free(struct srv6_locator_chunk *chunk)