diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index 5445e33af0..620e97574f 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -1510,17 +1510,17 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, return status; } -typedef struct pjsua_send_request_data +typedef struct send_request_data { pjsua_acc_id acc_id; void *token; -} pjsua_send_request_data; +} send_request_data; -static void on_acc_tsx_state(void *request_data, pjsip_event *event) +static void on_send_request(void *request_data, pjsip_event *event) { - pjsua_send_request_data *request_data_ = (pjsua_send_request_data*) request_data; - if (request_data_) - (pjsua_var.ua_cfg.cb.on_acc_send_request)(request_data_->acc_id, request_data_->token, event); + send_request_data *data = (send_request_data*) request_data; + if (data && pjsua_var.ua_cfg.cb.on_acc_send_request) + (pjsua_var.ua_cfg.cb.on_acc_send_request)(data->acc_id, data->token, event); } PJ_DEF(pj_status_t) pjsua_acc_send_request(pjsua_acc_id acc_id, @@ -1530,15 +1530,17 @@ PJ_DEF(pj_status_t) pjsua_acc_send_request(pjsua_acc_id acc_id, void *token, const pjsua_msg_data *msg_data) { - const pjsip_hdr *cap_hdr; + const pjsip_hdr *cap_hdr = NULL; pjsip_method method_; pj_status_t status; pjsip_tx_data *tdata = NULL; - pjsua_send_request_data *request_data; + send_request_data *request_data = NULL; - PJ_UNUSED_ARG(options); PJ_ASSERT_RETURN(acc_id>=0, PJ_EINVAL); PJ_ASSERT_RETURN(dest_uri, PJ_EINVAL); + PJ_ASSERT_RETURN(method, PJ_EINVAL); + PJ_UNUSED_ARG(options); + PJ_ASSERT_RETURN(msg_data, PJ_EINVAL); PJ_LOG(4,(THIS_FILE, "Account %d sending %.*s request..", acc_id, (int)method->slen, method->ptr)); @@ -1551,7 +1553,11 @@ PJ_DEF(pj_status_t) pjsua_acc_send_request(pjsua_acc_id acc_id, goto on_return; } - request_data = PJ_POOL_ZALLOC_T(tdata->pool, pjsua_send_request_data); + request_data = PJ_POOL_ZALLOC_T(tdata->pool, send_request_data); + if (!request_data) { + status = PJ_ENOMEM; + goto on_return; + } request_data->acc_id = acc_id; request_data->token = token; @@ -1563,7 +1569,7 @@ PJ_DEF(pj_status_t) pjsua_acc_send_request(pjsua_acc_id acc_id, (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, cap_hdr)); } - status = pjsip_endpt_send_request(pjsua_var.endpt, tdata, -1, request_data, &on_acc_tsx_state); + status = pjsip_endpt_send_request(pjsua_var.endpt, tdata, -1, request_data, &on_send_request); if (status != PJ_SUCCESS) { pjsua_perror(THIS_FILE, "Unable to send request", status); goto on_return; diff --git a/pjsip/src/pjsua2/account.cpp b/pjsip/src/pjsua2/account.cpp index 8d5069b8f4..25566ac233 100644 --- a/pjsip/src/pjsua2/account.cpp +++ b/pjsip/src/pjsua2/account.cpp @@ -120,7 +120,7 @@ void RtcpFbConfig::writeObject(ContainerNode &node) const PJSUA2_THROW(Error) /////////////////////////////////////////////////////////////////////////////// SendRequestParam::SendRequestParam() -: method("") +: userData(NULL), method("") { }