Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscelaneous Coverity fixes #3792

Merged
merged 2 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pjmedia/src/pjmedia/conference.c
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,7 @@ PJ_DEF(pj_status_t) pjmedia_conf_disconnect_port( pjmedia_conf *conf,
unsigned sink_slot )
{
struct conf_port *src_port, *dst_port;
pj_bool_t no_conn = PJ_FALSE;
unsigned i;

/* Check arguments */
Expand Down Expand Up @@ -1098,9 +1099,12 @@ PJ_DEF(pj_status_t) pjmedia_conf_disconnect_port( pjmedia_conf *conf,
pjmedia_delay_buf_reset(src_port->delay_buf);
}

/* Evaluate connect_cnt with mutex, but pause sound dev outside mutex */
no_conn = (conf->connect_cnt == 0);

pj_mutex_unlock(conf->mutex);

if (conf->connect_cnt == 0) {
if (no_conn) {
pause_sound(conf);
}

Expand Down
4 changes: 3 additions & 1 deletion pjsip-apps/src/pjsua/pjsua_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -1111,8 +1111,10 @@ void on_ip_change_progress(pjsua_ip_change_op op,
case PJSUA_IP_CHANGE_OP_COMPLETED:
pj_ansi_snprintf(info_str, sizeof(info_str),
"done");
break;
default:
info_str[0] = '\0';
pj_ansi_snprintf(info_str, sizeof(info_str),
"unknown-op");
break;
}
PJ_LOG(3,(THIS_FILE, "IP change progress report : %s", info_str));
Expand Down
4 changes: 3 additions & 1 deletion pjsip/src/pjsip-simple/publishc.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,6 @@ PJ_DEF(pj_status_t) pjsip_publishc_send(pjsip_publishc *pubc,
return PJ_EBUSY;
}
}
pj_mutex_unlock(pubc->mutex);

/* If via_addr is set, use this address for the Via header. */
if (pubc->via_addr.host.slen > 0) {
Expand All @@ -798,6 +797,9 @@ PJ_DEF(pj_status_t) pjsip_publishc_send(pjsip_publishc *pubc,
* may be called even before send_request() returns!
*/
++pubc->pending_tsx;

pj_mutex_unlock(pubc->mutex);

status = pjsip_endpt_send_request(pubc->endpt, tdata, -1, pubc,
&tsx_callback);
if (status!=PJ_SUCCESS) {
Expand Down
18 changes: 13 additions & 5 deletions pjsip/src/pjsip/sip_transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ pjsip_tsx_detect_merged_requests(pjsip_rx_data *rdata)
{
pj_str_t key, key2;
pj_uint32_t hval = 0;
pjsip_transaction *tsx = NULL;
pj_status_t status;

PJ_ASSERT_RETURN(rdata->msg_info.msg->type == PJSIP_REQUEST_MSG, NULL);
Expand All @@ -895,12 +896,15 @@ pjsip_tsx_detect_merged_requests(pjsip_rx_data *rdata)
if (status != PJ_SUCCESS)
return NULL;

pj_mutex_lock( mod_tsx_layer.mutex );

/* This request must not match any transaction in our primary hash
* table.
*/
if (pj_hash_get_lower(mod_tsx_layer.htable, key.ptr, (unsigned)key.slen,
&hval) != NULL)
{
pj_mutex_unlock( mod_tsx_layer.mutex);
return NULL;
}

Expand All @@ -910,14 +914,18 @@ pjsip_tsx_detect_merged_requests(pjsip_rx_data *rdata)
status = create_tsx_key_2543(rdata->tp_info.pool, &key2, PJSIP_ROLE_UAS,
&rdata->msg_info.cseq->method, rdata,
PJ_FALSE);
if (status != PJ_SUCCESS)
if (status != PJ_SUCCESS) {
pj_mutex_unlock( mod_tsx_layer.mutex);
return NULL;
}

hval = 0;
return (pjsip_transaction *) pj_hash_get_lower(mod_tsx_layer.htable2,
key2.ptr,
(unsigned)key2.slen,
&hval);
tsx = pj_hash_get_lower(mod_tsx_layer.htable2, key2.ptr,
(unsigned)key2.slen, &hval);

pj_mutex_unlock( mod_tsx_layer.mutex);

return tsx;
}

/* This module callback is called when endpoint has received an
Expand Down
Loading