[neard][PATCH v2 55/73] unit: do not open-code freeing ndef message

Krzysztof Kozlowski <[email protected]>
Newsgroups dev.linux.lists.oe-linux-nfc,org.01.lists.linux-nfc
Message-ID <[email protected]>
Use near_ndef_msg_free() instead of open-coding it.

Signed-off-by: Krzysztof Kozlowski <[email protected]>

---

Changes since v1:
1. Change also test_snep_cleanup()
---
 unit/test-snep-read.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/unit/test-snep-read.c b/unit/test-snep-read.c
index 414b801a5e71..213b3e5b3d74 100644
--- a/unit/test-snep-read.c
+++ b/unit/test-snep-read.c
@@ -222,10 +222,8 @@ static void test_snep_cleanup(gpointer context, gconstpointer data)
 	if (stored_recd)
 		test_ndef_free_record(stored_recd);
 
-	if (ctx->test_recd_msg) {
-		g_free(ctx->test_recd_msg->data);
-		g_free(ctx->test_recd_msg);
-	}
+	if (ctx->test_recd_msg)
+		near_ndef_msg_free(ctx->test_recd_msg);
 
 	g_slist_free(test_fragments);
 
@@ -896,8 +894,7 @@ static void test_snep_response_put_get_ndef(gpointer context,
 
 	g_free(req);
 	g_free(resp);
-	g_free(ndef->data);
-	g_free(ndef);
+	near_ndef_msg_free(ndef);
 }
 
 int main(int argc, char **argv)
-- 
2.27.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.