From b409c78066ea6fe2c2451ede86a2303c413b5e4b Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Thu, 12 Apr 2018 22:08:18 +0200 Subject: [PATCH] interface-ip: fix memory leak on error in interface_update_prefix_assignments() Detected by coverity in CID 141267 Signed-off-by: Hans Dedecker --- interface-ip.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/interface-ip.c b/interface-ip.c index 6726a69..27e9e41 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -994,8 +994,10 @@ static void interface_update_prefix_assignments(struct device_prefix *prefix, bo } entry = calloc(1, sizeof(*entry)); - if (!entry) + if (!entry) { + free(c); continue; + } entry->node.key = c; avl_insert(&assign_later, &entry->node); -- 2.25.1