Neels Hofmeyr has submitted this change and it was merged. (
https://gerrit.osmocom.org/12355 )
Change subject: mgcp_client_vty: fix missing talloc_free
......................................................................
mgcp_client_vty: fix missing talloc_free
If the vty client enters multiple local / remote addresses, that leaks talloc
memory of the previously set addresses. Free those first, if any, using
osmo_talloc_replace_string().
Change-Id: I331b3d53b5eb330b87d798f952077a043674d409
---
M src/libosmo-mgcp-client/mgcp_client_vty.c
1 file changed, 6 insertions(+), 4 deletions(-)
Approvals:
Harald Welte: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/libosmo-mgcp-client/mgcp_client_vty.c
b/src/libosmo-mgcp-client/mgcp_client_vty.c
index 48fcd70..ecc205f 100644
--- a/src/libosmo-mgcp-client/mgcp_client_vty.c
+++ b/src/libosmo-mgcp-client/mgcp_client_vty.c
@@ -43,8 +43,9 @@
if (!global_mgcp_client_conf)
return CMD_ERR_NOTHING_TODO;
OSMO_ASSERT(global_mgcp_client_ctx);
- global_mgcp_client_conf->local_addr =
- talloc_strdup(global_mgcp_client_ctx, argv[0]);
+ osmo_talloc_replace_string(global_mgcp_client_ctx,
+ (char**)&global_mgcp_client_conf->local_addr,
+ argv[0]);
return CMD_SUCCESS;
}
ALIAS_DEPRECATED(cfg_mgw_local_ip, cfg_mgcpgw_local_ip_cmd,
@@ -75,8 +76,9 @@
if (!global_mgcp_client_conf)
return CMD_ERR_NOTHING_TODO;
OSMO_ASSERT(global_mgcp_client_ctx);
- global_mgcp_client_conf->remote_addr =
- talloc_strdup(global_mgcp_client_ctx, argv[0]);
+ osmo_talloc_replace_string(global_mgcp_client_ctx,
+
(char**)&global_mgcp_client_conf->remote_addr,
+ argv[0]);
return CMD_SUCCESS;
}
ALIAS_DEPRECATED(cfg_mgw_remote_ip, cfg_mgcpgw_remote_ip_cmd,
--
To view, visit https://gerrit.osmocom.org/12355
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I331b3d53b5eb330b87d798f952077a043674d409
Gerrit-Change-Number: 12355
Gerrit-PatchSet: 3
Gerrit-Owner: Neels Hofmeyr <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <[email protected]>
Gerrit-Reviewer: Pau Espin Pedrol <[email protected]>
Gerrit-CC: Vadim Yanitskiy <[email protected]>