summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2019-07-31 14:39:51 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2019-07-31 14:39:51 -0400
commitb6925dc8af7bbd4a069aacf4c51dec1683f796bf (patch)
treeba38d755013d0d3286be016b6b02cea9c19870a5
parent1149e7b2792b2daca09587fb50ce522e452c417e (diff)
downloadlibnice-b6925dc8af7bbd4a069aacf4c51dec1683f796bf.tar.gz
test-udp-turn-fragmentation: Avoid leaking test socket
-rw-r--r--tests/test-udp-turn-fragmentation.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/test-udp-turn-fragmentation.c b/tests/test-udp-turn-fragmentation.c
index ef224f1..9e5ceda 100644
--- a/tests/test-udp-turn-fragmentation.c
+++ b/tests/test-udp-turn-fragmentation.c
@@ -113,13 +113,13 @@ test_socket_is_reliable (NiceSocket *sock) {
static void
test_socket_close (NiceSocket *sock) {
- g_free(sock->priv);
+ g_free (sock->priv);
}
static NiceSocket *
test_socket_new (GSList *msg_data)
{
- NiceSocket *sock = g_new0 (NiceSocket, 1);
+ NiceSocket *sock = g_slice_new0 (NiceSocket);
TestSocketPriv *priv = g_new0 (TestSocketPriv, 1);
priv->msg_data = msg_data;
priv->current_msg = msg_data;
@@ -146,6 +146,7 @@ tcp_turn_fragmentation (void)
GSList *test_messages = generate_test_messages ();
NiceAddress addr;
NiceSocket *turnsock;
+ NiceSocket *testsock;
NiceInputMessage recv_messages[N_RECV_MESSAGES];
GInputVector recv_vectors[N_RECV_MESSAGES];
@@ -167,8 +168,10 @@ tcp_turn_fragmentation (void)
nice_address_set_from_string (&addr, "127.0.0.1");
+ testsock = test_socket_new (test_messages);
+
turnsock = nice_udp_turn_socket_new (NULL, &addr,
- test_socket_new (test_messages), &addr, "", "",
+ testsock, &addr, "", "",
NICE_TURN_SOCKET_COMPATIBILITY_OC2007);
li = test_messages;
@@ -197,7 +200,8 @@ tcp_turn_fragmentation (void)
}
g_slist_free (test_messages);
- nice_socket_free(turnsock);
+ nice_socket_free (turnsock);
+ nice_socket_free (testsock);
}
int