diff options
author | Szymon Janc <szymon.janc@tieto.com> | 2013-01-04 16:10:34 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-01-31 01:35:38 +0100 |
commit | 7c9774af43084b3cd684d47a5cffa7ab708ff1bf (patch) | |
tree | a19e12ba9348501a8d5355fe72309320f7a4db13 /src | |
parent | fca1be21c62ff6e5da923674422cbd41ab30271d (diff) | |
download | neard-7c9774af43084b3cd684d47a5cffa7ab708ff1bf.tar.gz neard-7c9774af43084b3cd684d47a5cffa7ab708ff1bf.tar.bz2 neard-7c9774af43084b3cd684d47a5cffa7ab708ff1bf.zip |
ndef: Fix checking for error in parse_mime_type
Upper layer don't know if action will be held or not when providing
ndef_message for reply. It is possible that reply was provided but
not used and this is not always an error
Diffstat (limited to 'src')
-rw-r--r-- | src/ndef.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -1415,23 +1415,25 @@ parse_mime_type(struct near_ndef_record *record, uint8_t *ndef_data, data.state = CPS_UNKNOWN; if (__near_agent_handover_registered() == TRUE) { - if (action == TRUE) + if (action == TRUE) { err = __near_agent_handover_push_data(&data); - else if (reply != NULL) + } else if (reply != NULL) { *reply = near_ndef_prepare_handover_record("Hs", record, NEAR_CARRIER_BLUETOOTH, &data); + if (*reply == NULL) + err = -ENOMEM; + } } else { err = __near_bluetooth_parse_oob_record(&data, &mime->handover.properties, action); - if (err == 0 && reply != NULL) + if (err == 0 && reply != NULL) { *reply = near_ndef_prepare_handover_record("Hs", record, NEAR_CARRIER_BLUETOOTH, NULL); + if (*reply == NULL) + err = -ENOMEM; + } } - /* check if requested reply message was created successfully */ - if (reply != NULL && *reply == NULL) - err = -ENOMEM; - done: if (err < 0) { DBG("Parsing mime error %d", err); |