From 57ff57ac5cdf59b8724db326873dce7769da6471 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 13 Oct 2021 16:37:59 +0200 Subject: e1inp_input: Fix e1inp_line_clone removing original line from global list when freed Since a recent commit (see hash below), e1_input.c code was fixed to release the line from the global line list (e1inp_line_list) before freeing the object. However, the change didn't have into account that there were cloned lines from the original one which had a duplicate of the original line->list. Hence, whenver a clone was freed, it actually removed the original line from the global list. Since the original line is the one actually holding the permanent reference due to being configured over VTY, let's fix e1inp_line_clone to reset the clone->list so that whenever it is freed it doesn't affect the original line. Fixes: 49924f0a79db69c7e180543299a9e1078d5c16ac Related: SYS#5642 Change-Id: I0627da0d28057649b494e2bd83b283b09fb9a2d7 --- src/e1_input.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/e1_input.c b/src/e1_input.c index 9fb8a3b..6507835 100644 --- a/src/e1_input.c +++ b/src/e1_input.c @@ -563,6 +563,8 @@ e1inp_line_clone(void *ctx, struct e1inp_line *line, const char *use) .use_cb = e1inp_line_use_cb, .use_counts = {0}, }; + /* initialize list so it can be safely deleted without affecting original line */ + INIT_LLIST_HEAD(&clone->list); e1inp_line_get2(clone, use); /* Clone is used internally for bfd */ return clone; } -- cgit v1.2.3