fixeria submitted this change.

View Change


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

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)

To view, visit change 36616. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I356818aae3addab6db39de9a625453b7435b7cc1
Gerrit-Change-Number: 36616
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged