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 01:18:38 UTC 2018


Neels Hofmeyr has uploaded this change for review. ( 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.

Change-Id: I331b3d53b5eb330b87d798f952077a043674d409
---
M src/libosmo-mgcp-client/mgcp_client_vty.c
1 file changed, 4 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/55/12355/1

diff --git a/src/libosmo-mgcp-client/mgcp_client_vty.c b/src/libosmo-mgcp-client/mgcp_client_vty.c
index e19dbee..b81fcd0 100644
--- a/src/libosmo-mgcp-client/mgcp_client_vty.c
+++ b/src/libosmo-mgcp-client/mgcp_client_vty.c
@@ -43,6 +43,8 @@
 	if (!global_mgcp_client_conf)
 		return CMD_ERR_NOTHING_TODO;
 	OSMO_ASSERT(global_mgcp_client_ctx);
+	if (global_mgcp_client_conf->local_addr)
+		talloc_free((char*)global_mgcp_client_conf->local_addr);
 	global_mgcp_client_conf->local_addr =
 		talloc_strdup(global_mgcp_client_ctx, argv[0]);
 	return CMD_SUCCESS;
@@ -75,6 +77,8 @@
 	if (!global_mgcp_client_conf)
 		return CMD_ERR_NOTHING_TODO;
 	OSMO_ASSERT(global_mgcp_client_ctx);
+	if (global_mgcp_client_conf->remote_addr)
+		talloc_free((char*)global_mgcp_client_conf->remote_addr);
 	global_mgcp_client_conf->remote_addr =
 		talloc_strdup(global_mgcp_client_ctx, argv[0]);
 	return CMD_SUCCESS;

-- 
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: newchange
Gerrit-Change-Id: I331b3d53b5eb330b87d798f952077a043674d409
Gerrit-Change-Number: 12355
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181219/c90351ee/attachment.htm>


More information about the gerrit-log mailing list