diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-11-06 10:40:53 +0000 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-11-06 10:40:53 +0000 |
commit | 8afd815d98cc25db1063715109957333db1f4574 (patch) | |
tree | e09457fdb05ef72280de30b4c8befc4667fba69c | |
parent | 44e7ea310559b9dbea0bae27fce60e602913f316 (diff) |
tests: Fix a memory leak in test-send-recv
If n_messages ≠ n_valid_messages.
-rw-r--r-- | tests/test-send-recv.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/test-send-recv.c b/tests/test-send-recv.c index c633655..eac5b91 100644 --- a/tests/test-send-recv.c +++ b/tests/test-send-recv.c @@ -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); } |