diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index 46c5485..a4d0153 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c
struct avctp_channel *chan;
uint8_t transaction;
guint timeout;
+ int err;
avctp_process_cb process;
void *data;
GDestroyNotify destroy;
static void control_req_destroy(void *data)
{
struct avctp_control_req *req = data;
+ struct avctp_pending_req *p = req->p;
+ struct avctp *session = p->chan->session;
+
+ if (p->err == 0 || req->func == NULL)
+ goto done;
+ req->func(session, AVC_CTYPE_REJECTED, req->subunit, NULL, 0,
+ req->user_data);
+
+done:
g_free(req->operands);
g_free(req);
}
static void browsing_req_destroy(void *data)
{
struct avctp_browsing_req *req = data;
+ struct avctp_pending_req *p = req->p;
+ struct avctp *session = p->chan->session;
+
+ if (p->err == 0 || req->func == NULL)
+ goto done;
+ req->func(session, NULL, 0, req->user_data);
+
+done:
g_free(req->operands);
g_free(req);
}
DBG("transaction %u", p->transaction);
p->timeout = 0;
+ p->err = -ETIMEDOUT;
pending_destroy(p, NULL);
chan->p = NULL;
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index 89ba58c..dac7ece 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
uint32_t position;
uint8_t status;
- if (code == AVC_CTYPE_REJECTED || ntohs(pdu->params_len) != 9)
+ if (pdu == NULL || code == AVC_CTYPE_REJECTED ||
+ ntohs(pdu->params_len) != 9)
return FALSE;
memcpy(&duration, pdu->params, sizeof(uint32_t));
uint8_t count;
int i;
+ if (pdu == NULL) {
+ media_player_set_setting(mp, "Error", "Timeout");
+ return FALSE;
+ }
+
if (code == AVC_CTYPE_REJECTED) {
media_player_set_setting(mp, "Error",
status_to_str(pdu->params[0]));
uint8_t depth, count;
size_t i;
- if (pdu->params[0] != AVRCP_STATUS_SUCCESS || operand_count < 13)
+ if (pdu == NULL || pdu->params[0] != AVRCP_STATUS_SUCCESS ||
+ operand_count < 13)
return FALSE;
player->uid_counter = bt_get_be16(&pdu->params[1]);
struct avrcp_browsing_header *pdu = (void *) operands;
uint8_t count;
+ if (pdu == NULL) {
+ avrcp_get_element_attributes(session);
+ return FALSE;
+ }
+
if (pdu->params[0] != AVRCP_STATUS_SUCCESS || operand_count < 4) {
if (pdu->params[0] == AVRCP_STATUS_PLAYER_NOT_BROWSABLE)
avrcp_get_element_attributes(session);
size_t i;
GSList *removed;
- if (pdu->params[0] != AVRCP_STATUS_SUCCESS || operand_count < 5)
+ if (pdu == NULL || pdu->params[0] != AVRCP_STATUS_SUCCESS ||
+ operand_count < 5)
return FALSE;
removed = g_slist_copy(session->players);
struct avrcp_header *pdu = (void *) operands;
uint8_t event;
- if (code != AVC_CTYPE_INTERIM && code != AVC_CTYPE_CHANGED)
+ if ((code != AVC_CTYPE_INTERIM && code != AVC_CTYPE_CHANGED) ||
+ pdu == NULL)
return FALSE;
event = pdu->params[0];
uint16_t events = 0;
uint8_t count;
- if (pdu->params[0] != CAP_EVENTS_SUPPORTED)
+ if (pdu == NULL || pdu->params[0] != CAP_EVENTS_SUPPORTED)
return FALSE;
count = pdu->params[1];
struct avrcp_header *pdu = (void *) operands;
uint8_t volume;
- if (code == AVC_CTYPE_REJECTED || code == AVC_CTYPE_NOT_IMPLEMENTED)
+ if (code == AVC_CTYPE_REJECTED || code == AVC_CTYPE_NOT_IMPLEMENTED ||
+ pdu == NULL)
return FALSE;
volume = pdu->params[0] & 0x7F;