pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-mgw/+/39721?usp=email )
Change subject: mgw: Use tall_mgw_ctx to allocate struct mgcp_config
......................................................................
mgw: Use tall_mgw_ctx to allocate struct mgcp_config
Change-Id: Ib51f1066bb73da4472bd8967cc1b1c44e964e9e5
---
M include/osmocom/mgcp/mgcp.h
M src/libosmo-mgcp/mgcp_protocol.c
M tests/mgcp/mgcp_test.c
3 files changed, 6 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/21/39721/1
diff --git a/include/osmocom/mgcp/mgcp.h b/include/osmocom/mgcp/mgcp.h
index 41eee42..f72807e 100644
--- a/include/osmocom/mgcp/mgcp.h
+++ b/include/osmocom/mgcp/mgcp.h
@@ -40,6 +40,8 @@
#include "mgcp_ratectr.h"
+extern void *tall_mgw_ctx;
+
#define RTP_PORT_DEFAULT_RANGE_START 16002
#define RTP_PORT_DEFAULT_RANGE_END RTP_PORT_DEFAULT_RANGE_START + 64
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 1eb241b..163b816 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -1505,7 +1505,7 @@
* appropiate place! */
struct mgcp_config *cfg;
- cfg = talloc_zero(NULL, struct mgcp_config);
+ cfg = talloc_zero(tall_mgw_ctx, struct mgcp_config);
if (!cfg) {
LOGP(DLMGCP, LOGL_FATAL, "Failed to allocate config.\n");
return NULL;
diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index 1c1a41e..b9224d9 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -43,6 +43,8 @@
#include <math.h>
#include <ctype.h>
+void *tall_mgw_ctx;
+
char *strline_r(char *str, char **saveptr);
const char *strline_test_data =
@@ -2323,7 +2325,7 @@
INIT_LLIST_HEAD(&endp.conns);
- conn = talloc_zero(NULL, struct mgcp_conn);
+ conn = talloc_zero(tall_mgw_ctx, struct mgcp_conn);
OSMO_ASSERT(conn);
osmo_strlcpy(conn->id, conn_id_generated, sizeof(conn->id));
llist_add(&conn->entry, &endp.conns);
--
To view, visit
https://gerrit.osmocom.org/c/osmo-mgw/+/39721?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Ib51f1066bb73da4472bd8967cc1b1c44e964e9e5
Gerrit-Change-Number: 39721
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>