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 <[email protected]>

Reply via email to