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

Krzysztof Kozlowski <[email protected]> Mon, 19 Jul 2021 13:07:46 +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]>
---
 src/tag.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/tag.c b/src/tag.c
index 520368b1552c..ce8c477d9527 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -459,14 +459,12 @@ static DBusMessage *write_ndef(DBusConnection *conn,
 		break;
 
 	default:
-		g_free(ndef->data);
-		g_free(ndef);
+		near_ndef_msg_free(ndef);
 
 		return __near_error_failed(msg, EOPNOTSUPP);
 	}
 
-	g_free(ndef->data);
-	g_free(ndef);
+	near_ndef_msg_free(ndef);
 
 	tag->write_ndef = ndef_with_header;
 	err = __near_tag_write(tag, ndef_with_header, write_cb);
-- 
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