Change in osmo-mgw[master]: mgcp_client_vty: fix missing talloc_free

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Dec 19 22:19:18 UTC 2018


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 <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-CC: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181219/f55fe6f4/attachment.htm>


More information about the gerrit-log mailing list