diff options
author | Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> | 2021-07-15 15:11:40 +0200 |
---|---|---|
committer | Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> | 2021-07-19 12:53:25 +0200 |
commit | ca0d1b11327c89973ade4fa1ff9fa102ddd27ba7 (patch) | |
tree | 35d6bb5c95dd3ac0f9c807e786032ccd3c0f7f38 | |
parent | af175fed75eafcb38d9f674fe260bef0ddbb0875 (diff) | |
download | neard-ca0d1b11327c89973ade4fa1ff9fa102ddd27ba7.tar.gz |
unit: fix memory leaks in test-snep-read error paths
Cleanup and free memory in error paths in test-snep-read.c.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
-rw-r--r-- | unit/test-snep-read.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/unit/test-snep-read.c b/unit/test-snep-read.c index 213b3e5..a463c1d 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; |