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
This commit is contained in:
Neels Hofmeyr
2018-12-19 00:30:34 +01:00
committed by Neels Hofmeyr
parent 96c3107daf
commit c3132fd508

View File

@@ -43,8 +43,9 @@ DEFUN(cfg_mgw_local_ip, cfg_mgw_local_ip_cmd,
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 @@ DEFUN(cfg_mgw_remote_ip, cfg_mgw_remote_ip_cmd,
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,