summaryrefslogtreecommitdiff
path: root/unit/test-gatt.c
diff options
context:
space:
mode:
Diffstat (limited to 'unit/test-gatt.c')
-rw-r--r--unit/test-gatt.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index d8d007386..e35271b61 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -48,7 +48,7 @@
struct test_pdu {
bool valid;
- const uint8_t *data;
+ uint8_t *data;
size_t size;
};
@@ -86,7 +86,7 @@ struct context {
#define raw_pdu(args...) \
{ \
.valid = true, \
- .data = data(args), \
+ .data = g_memdup(data(args), sizeof(data(args))), \
.size = sizeof(data(args)), \
}
@@ -306,6 +306,11 @@ static bt_uuid_t uuid_char_128 = {
static void test_free(gconstpointer user_data)
{
const struct test_data *data = user_data;
+ struct test_pdu *pdu;
+ int i;
+
+ for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++)
+ g_free(pdu->data);
g_free(data->test_name);
g_free(data->pdu_list);
@@ -1911,6 +1916,8 @@ static void test_server(gconstpointer data)
g_assert_cmpint(len, ==, pdu.size);
tester_monitor('<', 0x0004, 0x0000, pdu.data, len);
+
+ g_free(pdu.data);
}
static void test_search_primary(gconstpointer data)