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

Krzysztof Kozlowski <[email protected]> Mon, 19 Jul 2021 13:08:01 +0200
Newsgroups org.01.lists.linux-nfc,dev.linux.lists.oe-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
_______________________________________________
Linux-nfc mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s