summaryrefslogtreecommitdiff
path: root/zebra/zserv.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zserv.c')
-rw-r--r--zebra/zserv.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/zebra/zserv.c b/zebra/zserv.c
index ebe246ffbc..d788811d3d 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -78,6 +78,8 @@ static struct zserv *find_client_internal(uint8_t proto,
unsigned short instance,
uint32_t session_id);
+/* Mem type for zclients. */
+DEFINE_MTYPE_STATIC(ZEBRA, ZSERV_CLIENT, "ZClients");
/*
* Client thread events.
@@ -146,6 +148,14 @@ static void zserv_event(struct zserv *client, enum zserv_event event);
/* Client thread lifecycle -------------------------------------------------- */
/*
+ * Free a zserv client object.
+ */
+void zserv_client_delete(struct zserv *client)
+{
+ XFREE(MTYPE_ZSERV_CLIENT, client);
+}
+
+/*
* Log zapi message to zlog.
*
* errmsg (optional)
@@ -644,7 +654,7 @@ static void zserv_client_free(struct zserv *client)
if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug("%s: Deleting client %s", __func__,
zebra_route_string(client->proto));
- XFREE(MTYPE_TMP, client);
+ zserv_client_delete(client);
} else {
/* Handle cases where client has GR instance. */
if (IS_ZEBRA_DEBUG_EVENT)
@@ -733,7 +743,7 @@ static struct zserv *zserv_client_create(int sock)
int i;
afi_t afi;
- client = XCALLOC(MTYPE_TMP, sizeof(struct zserv));
+ client = XCALLOC(MTYPE_ZSERV_CLIENT, sizeof(struct zserv));
/* Make client input/output buffer. */
client->sock = sock;