Cleanup and free memory in error paths in test-snep-read.c. Signed-off-by: Krzysztof Kozlowski --- unit/test-snep-read.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/unit/test-snep-read.c b/unit/test-snep-read.c index 213b3e5b3d74..a463c1df30b8 100644 --- a/unit/test-snep-read.c +++ b/unit/test-snep-read.c @@ -131,12 +131,12 @@ static bool test_snep_dummy_req_put(int fd, void *data) records = near_ndef_parse_msg(nfc_data, nfc_data_length, NULL); if (!records) { TEST_SNEP_LOG("\tdummy_req_put parsing ndef failed\n"); - goto error; + goto error_free_nfc_data; } if (g_list_length(records) != 1) { TEST_SNEP_LOG("\tdummy_req_put records number mismatch"); - goto error; + goto error_free_records; } g_free(nfc_data); @@ -149,6 +149,10 @@ static bool test_snep_dummy_req_put(int fd, void *data) near_snep_core_response_noinfo(fd, NEAR_SNEP_RESP_SUCCESS); return true; +error_free_records: + near_ndef_records_free(records); +error_free_nfc_data: + g_free(nfc_data); error: TEST_SNEP_LOG("\tdummy_req_put error!!!\n"); return false; -- 2.27.0