Merge branch 'coverity01' of https://github.com/pjsip/pjproject into coverity01

This commit is contained in:
bennylp 2023-03-22 08:45:48 +07:00
commit 963192c76d
3 changed files with 12 additions and 7 deletions

View File

@ -273,6 +273,7 @@ PJ_DEF(pj_status_t) pj_turn_session_create( const pj_stun_config *cfg,
sess->ka_interval = PJ_TURN_KEEP_ALIVE_SEC;
sess->user_data = user_data;
sess->next_ch = PJ_TURN_CHANNEL_MIN;
pj_turn_alloc_param_default(&sess->alloc_param);
/* Copy STUN session */
pj_memcpy(&sess->stun_cfg, cfg, sizeof(pj_stun_config));
@ -777,8 +778,8 @@ PJ_DEF(pj_status_t) pj_turn_session_alloc(pj_turn_session *sess,
/* MUST include REQUESTED-TRANSPORT attribute */
pj_stun_msg_add_uint_attr(tdata->pool, tdata->msg,
PJ_STUN_ATTR_REQ_TRANSPORT,
PJ_STUN_SET_RT_PROTO(param->peer_conn_type));
PJ_STUN_ATTR_REQ_TRANSPORT,
PJ_STUN_SET_RT_PROTO(sess->alloc_param.peer_conn_type));
/* Include BANDWIDTH if requested */
if (sess->alloc_param.bandwidth > 0) {

View File

@ -106,8 +106,9 @@ PJ_DECL(void) pjrpid_element_dup(pj_pool_t *pool, pjrpid_element *dst,
* Add RPID element information into existing PIDF document. This will also
* add the appropriate XML namespace attributes into the presence's XML
* node, if the attributes are not already present, and also a <note> element
* to the first <tuple> element of the PIDF document, if a <note> element
* is not present.
* if it is not present. The <note> element is added to the first <tuple>
* element of the PIDF document, or if there is no <tuple> element found,
* to the root <presence> element of the document.
*
* @param pres The PIDF presence document.
* @param pool Pool.

View File

@ -114,16 +114,19 @@ PJ_DEF(pj_status_t) pjrpid_add_element(pjpidf_pres *pres,
PJ_UNUSED_ARG(options);
/* Add <note> to <tuple>, if none */
/* Add <note>, if none. We add it to the first <tuple>, if any,
* otherwise to the root <presence>.
*/
if (elem->note.slen != 0) {
pj_xml_node *nd_tuple;
nd_tuple = find_node(pres, "tuple");
nd_note = nd_tuple? find_node(nd_tuple, "note"):NULL;
nd_note = nd_tuple? find_node(nd_tuple, "note"):
find_node(pres, "note");
if (!nd_note) {
nd_note = pj_xml_node_new(pool, &NOTE);
pj_strdup(pool, &nd_note->content, &elem->note);
pj_xml_add_node(nd_tuple, nd_note);
pj_xml_add_node(nd_tuple? nd_tuple: pres, nd_note);
nd_note = NULL;
}
}