Commit 8afd815d authored by Philip Withnall's avatar Philip Withnall

tests: Fix a memory leak in test-send-recv

If n_messages ≠ n_valid_messages.
parent 44e7ea31
......@@ -488,8 +488,6 @@ validate_received_messages (TestIOStreamThreadData *data, gsize buffer_offset,
message_len_remaining -= valid_len;
}
test_data->received_bytes += valid_len;
g_free (buffer->buffer);
}
g_assert_cmpuint (message->length, <=, total_buf_len);
......@@ -505,6 +503,18 @@ validate_received_messages (TestIOStreamThreadData *data, gsize buffer_offset,
g_assert_cmpuint (message->length, ==, total_buf_len);
g_assert (message->from == NULL);
}
/* Free all messages. */
for (i = 0; i < (guint) n_messages; i++) {
NiceInputMessage *message = &messages[i];
guint j;
for (j = 0; j < (guint) message->n_buffers; j++) {
GInputVector *buffer = &message->buffers[j];
g_free (buffer->buffer);
}
g_free (message->buffers);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment