From 865bf7cac66a5853b0eb75c23fa5bab63a2b4485 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Tue, 8 Sep 2020 15:02:39 -0600 Subject: [PATCH] state: plug memory leak when upserting --- libifupdown/state.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libifupdown/state.c b/libifupdown/state.c index 5ff80cc..4509031 100644 --- a/libifupdown/state.c +++ b/libifupdown/state.c @@ -66,6 +66,8 @@ lif_state_read_path(struct lif_dict *state, const char *path) void lif_state_upsert(struct lif_dict *state, const char *ifname, struct lif_interface *iface) { + lif_state_delete(state, ifname); + struct lif_state_record *rec = calloc(1, sizeof(*rec)); rec->mapped_if = strdup(iface->ifname);