fixeria has submitted this change. ( 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(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve osmith: Looks good to me, approved
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)