diff options
Diffstat (limited to 'openbsc/tests/bsc-nat/bsc_nat_test.c')
-rw-r--r-- | openbsc/tests/bsc-nat/bsc_nat_test.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c index 10b876b37..def6bfec8 100644 --- a/openbsc/tests/bsc-nat/bsc_nat_test.c +++ b/openbsc/tests/bsc-nat/bsc_nat_test.c @@ -425,20 +425,18 @@ static void test_mgcp_find(void) static void test_mgcp_rewrite(void) { int i; - struct msgb *input, *output; + struct msgb *output; fprintf(stderr, "Test rewriting MGCP messages.\n"); - input = msgb_alloc(4096, "input"); - for (i = 0; i < ARRAY_SIZE(mgcp_messages); ++i) { const char *orig = mgcp_messages[i].orig; const char *patc = mgcp_messages[i].patch; const char *ip = mgcp_messages[i].ip; const int port = mgcp_messages[i].port; - copy_to_msg(input, (const u_int8_t *) orig, strlen(orig) + 1); + char *input = strdup(orig); - output = bsc_mgcp_rewrite(input, ip, port); + output = bsc_mgcp_rewrite(input, strlen(input), ip, port); if (msgb_l2len(output) != strlen(patc)) { fprintf(stderr, "Wrong sizes for test: %d %d != %d != %d\n", i, msgb_l2len(output), strlen(patc), strlen(orig)); fprintf(stderr, "String '%s' vs '%s'\n", (const char *) output->l2h, patc); @@ -451,9 +449,8 @@ static void test_mgcp_rewrite(void) } msgb_free(output); + free(input); } - - msgb_free(input); } static void test_mgcp_parse(void) |