summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2013-01-04 16:10:34 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2013-01-31 01:35:38 +0100
commit7c9774af43084b3cd684d47a5cffa7ab708ff1bf (patch)
treea19e12ba9348501a8d5355fe72309320f7a4db13 /src
parentfca1be21c62ff6e5da923674422cbd41ab30271d (diff)
downloadneard-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.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/ndef.c b/src/ndef.c
index a39ad36..75fa881 100644
--- a/src/ndef.c
+++ b/src/ndef.c
@@ -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);