aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-10-13 16:37:59 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-10-13 16:38:02 +0200
commit57ff57ac5cdf59b8724db326873dce7769da6471 (patch)
tree33c15769c41821ee406272fea8b16e61f3ea0170
parentipaccess: e1inp_ipa_bts_rsl_connect: Fix memleak recreating ipa_client_conn (diff)
downloadlibosmo-abis-57ff57ac5cdf59b8724db326873dce7769da6471.tar.xz
libosmo-abis-57ff57ac5cdf59b8724db326873dce7769da6471.zip
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
-rw-r--r--src/e1_input.c2
1 files changed, 2 insertions, 0 deletions
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;
}