diff options
author | Martijn Coenen <maco@google.com> | 2016-05-11 17:34:55 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-05-11 17:34:55 +0000 |
commit | 521bca9ceda94da2d15d82ceb12830c7b5019030 (patch) | |
tree | a94c0474b20935bba5eea24204cf82c0e1cc0f16 | |
parent | 6b4cc13b56f7e319ed2a613ac9c3df0f37ba133a (diff) | |
parent | ce0c63a05ff779753b54b23a09ac6724d64cab71 (diff) | |
download | libnfc-nci-521bca9ceda94da2d15d82ceb12830c7b5019030.tar.gz |
Merge "Free memory in case of error response" am: 3a6393f85f
am: ce0c63a05f
* commit 'ce0c63a05ff779753b54b23a09ac6724d64cab71':
Free memory in case of error response
Change-Id: I2e2ef6f956789cd62e72a9ce7799ccfcd0cdb31c
-rw-r--r-- | src/nfc/tags/rw_t1t.c | 16 | ||||
-rw-r--r-- | src/nfc/tags/rw_t2t.c | 18 | ||||
-rw-r--r-- | src/nfc/tags/rw_t3t.c | 6 |
3 files changed, 31 insertions, 9 deletions
diff --git a/src/nfc/tags/rw_t1t.c b/src/nfc/tags/rw_t1t.c index e7d373e..1fd074e 100644 --- a/src/nfc/tags/rw_t1t.c +++ b/src/nfc/tags/rw_t1t.c @@ -254,11 +254,19 @@ void rw_t1t_conn_cback (UINT8 conn_id, tNFC_CONN_EVT event, tNFC_CONN *p_data) break; case NFC_DATA_CEVT: - if ( (p_data != NULL) - &&(p_data->data.status == NFC_STATUS_OK) ) + if (p_data != NULL) { - rw_t1t_data_cback (conn_id, event, p_data); - break; + if (p_data->data.status == NFC_STATUS_OK) + { + rw_t1t_data_cback (conn_id, event, p_data); + break; + } + else if (p_data->data.p_data != NULL) + { + /* Free the response buffer in case of error response */ + GKI_freebuf ((BT_HDR *) (p_data->data.p_data)); + p_data->data.p_data = NULL; + } } /* Data event with error status...fall through to NFC_ERROR_CEVT case */ diff --git a/src/nfc/tags/rw_t2t.c b/src/nfc/tags/rw_t2t.c index de2de64..3976b3b 100644 --- a/src/nfc/tags/rw_t2t.c +++ b/src/nfc/tags/rw_t2t.c @@ -297,12 +297,20 @@ void rw_t2t_conn_cback (UINT8 conn_id, tNFC_CONN_EVT event, tNFC_CONN *p_data) break; case NFC_DATA_CEVT: - if ( (p_data != NULL) - &&( (p_data->data.status == NFC_STATUS_OK) - ||(p_data->data.status == NFC_STATUS_CONTINUE) ) ) + if (p_data != NULL) { - rw_t2t_proc_data (conn_id, &(p_data->data)); - break; + if ( (p_data->data.status == NFC_STATUS_OK) + ||(p_data->data.status == NFC_STATUS_CONTINUE) ) + { + rw_t2t_proc_data (conn_id, &(p_data->data)); + break; + } + else if (p_data->data.p_data != NULL) + { + /* Free the response buffer in case of error response */ + GKI_freebuf ((BT_HDR *) (p_data->data.p_data)); + p_data->data.p_data = NULL; + } } /* Data event with error status...fall through to NFC_ERROR_CEVT case */ diff --git a/src/nfc/tags/rw_t3t.c b/src/nfc/tags/rw_t3t.c index 7db0fac..f8ec361 100644 --- a/src/nfc/tags/rw_t3t.c +++ b/src/nfc/tags/rw_t3t.c @@ -2369,6 +2369,12 @@ void rw_t3t_conn_cback (UINT8 conn_id, tNFC_CONN_EVT event, tNFC_CONN *p_data) rw_t3t_data_cback (conn_id, &(p_data->data)); break; } + else if (p_data->data.p_data != NULL) + { + /* Free the response buffer in case of error response */ + GKI_freebuf ((BT_HDR *) (p_data->data.p_data)); + p_data->data.p_data = NULL; + } /* Data event with error status...fall through to NFC_ERROR_CEVT case */ |