From 9866356f2349ff864869709785e036b366107222 Mon Sep 17 00:00:00 2001 From: Olivier Guiter Date: Mon, 15 Apr 2013 13:36:55 +0200 Subject: [PATCH] unit: Fix broken SNEP read unit test In "crash-1" loop, the snep_data was added to the slist, but not removed because of a specific exit condition. This fix swaps the test condition and the action on slist, in order to add the fragment only when the length test passed. --- unit/test-snep-read.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unit/test-snep-read.c b/unit/test-snep-read.c index 9ce2c1c..cb02054 100644 --- a/unit/test-snep-read.c +++ b/unit/test-snep-read.c @@ -101,11 +101,11 @@ static near_bool_t test_snep_dummy_req_put(int fd, void *data) if (stored_recd) TEST_SNEP_LOG("\tdummy_req_put already stored record\n"); - test_fragments = g_slist_append(test_fragments, snep_data); - if (snep_data->nfc_data_length > snep_data->nfc_data_current_length) return TRUE; + test_fragments = g_slist_append(test_fragments, snep_data); + nfc_data_length = 0; nfc_data = g_try_malloc0(snep_data->nfc_data_length); g_assert(nfc_data != NULL); -- 2.7.4