unit: Fix broken SNEP read unit test
authorOlivier Guiter <olivier.guiter@linux.intel.com>
Mon, 15 Apr 2013 11:36:55 +0000 (13:36 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 15 Apr 2013 12:15:35 +0000 (14:15 +0200)
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

index 9ce2c1c..cb02054 100644 (file)
@@ -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);