From 00f7dda05ba76ee3aff954e84f9795460e2fb917 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Wed, 12 Jun 2013 10:49:18 +0200 Subject: [PATCH] ndef: Do not fail if NDEF record MIME type is not a handover one NDEFs with MIME type records that are not WSC or Bluetooth ones are not wrong. Their payload won't be processed but the record is kept and linked to the discovered tag. NDEF agents will get the binary payload. Fixes #NFC-45 --- src/ndef.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ndef.c b/src/ndef.c index a3db363..1bcb164 100644 --- a/src/ndef.c +++ b/src/ndef.c @@ -1365,13 +1365,10 @@ static struct near_ndef_mime_payload *parse_mime_type( c_temp->size = record->header->payload_len; memcpy(c_temp->data, ndef_data + offset, c_temp->size); } else { - g_free(mime->type); - g_free(mime); g_free(c_temp); - mime = NULL; c_temp = NULL; *c_data = NULL; - return NULL; + return mime; } *c_data = c_temp; @@ -2577,9 +2574,13 @@ GList *near_ndef_parse_msg(uint8_t *ndef_data, size_t ndef_length, ndef_length, offset, record->header->payload_len, &c_data); - if (record->mime == NULL || c_data == NULL) + if (record->mime == NULL) goto fail; + /* No carrier data, move on */ + if (c_data == NULL) + break; + if (process_mime_type(record->mime, c_data) < 0) { g_free(c_data); c_data = NULL; -- 2.7.4