From: Philippe Guibert Date: Wed, 25 Sep 2019 06:51:06 +0000 (+0200) Subject: zebra: fix memory leak X-Git-Tag: base_7.3~308^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=fc341a97917b7f808ea9f72b7cab9feb3b7e4024;p=matthieu%2Ffrr.git zebra: fix memory leak the if_lookup_by_name_per_ns keeps a lock on the node where the searched ifp is stored. Then this node can not be freed even if the ifp is removed from the node. Just add the missing unlock (as for the if_lookup_by_index_per_ns lookup function) Fixes: b8af3fbbafc8 ("zebra: fix detection of interface renames") Signed-off-by: Thibaut Collet Signed-off-by: Philippe Guibert --- diff --git a/zebra/interface.c b/zebra/interface.c index 6486c01430..368eecc2cf 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -261,8 +261,10 @@ struct interface *if_lookup_by_name_per_ns(struct zebra_ns *ns, for (rn = route_top(ns->if_table); rn; rn = route_next(rn)) { ifp = (struct interface *)rn->info; - if (ifp && strcmp(ifp->name, ifname) == 0) + if (ifp && strcmp(ifp->name, ifname) == 0) { + route_unlock_node(rn); return (ifp); + } } return NULL;