fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/36616?usp=email )
Change subject: vty: fix memleak in host_config_set() ......................................................................
vty: fix memleak in host_config_set()
Not only we call this function from vty_read_config_file(), but also from config_write_file_cmd. Thus we leak memory when doing 'write file FILE' in the VTY.
Change-Id: I356818aae3addab6db39de9a625453b7435b7cc1 --- M src/vty/command.c 1 file changed, 14 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/16/36616/1
diff --git a/src/vty/command.c b/src/vty/command.c index a3e0e36..1719690 100644 --- a/src/vty/command.c +++ b/src/vty/command.c @@ -4297,7 +4297,7 @@ /* Set config filename. Called from vty.c */ void host_config_set(const char *filename) { - host.config = talloc_strdup(tall_vty_cmd_ctx, filename); + osmo_talloc_replace_string(tall_vty_cmd_ctx, &host.config, filename); }
const char *host_config_file(void)