Skip to content

Commit

Permalink
Misc coverity fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nanangizz committed Oct 30, 2024
1 parent cc83544 commit f04b9de
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
5 changes: 0 additions & 5 deletions pjmedia/src/pjmedia/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -3077,21 +3077,16 @@ static void stream_on_destroy(void *arg)
pjmedia_stream* stream = (pjmedia_stream*)arg;

/* This function may be called when stream is partly initialized. */
if (stream->jb_mutex)
pj_mutex_lock(stream->jb_mutex);

/* Free codec. */

if (stream->codec) {
pjmedia_codec_close(stream->codec);
pjmedia_codec_mgr_dealloc_codec(stream->codec_mgr, stream->codec);
stream->codec = NULL;
}

/* Free mutex */

if (stream->jb_mutex) {
pj_mutex_unlock(stream->jb_mutex);
pj_mutex_destroy(stream->jb_mutex);
stream->jb_mutex = NULL;
}
Expand Down
4 changes: 3 additions & 1 deletion pjmedia/src/pjmedia/vid_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ PJ_DEF(pj_status_t) pjmedia_vid_conf_destroy(pjmedia_vid_conf *vid_conf)
}

/* Flush any pending operation (connect, disconnect, etc) */
handle_op_queue(vid_conf);
if (vid_conf->op_queue && vid_conf->op_queue_free) {
handle_op_queue(vid_conf);
}

/* Remove any registered ports (at least to cleanup their pool) */
for (i=0; i < vid_conf->opt.max_slot_cnt; ++i) {
Expand Down
15 changes: 9 additions & 6 deletions pjmedia/src/pjmedia/wav_playlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,10 @@ PJ_DEF(pj_status_t) pjmedia_wav_playlist_create(pj_pool_t *pool_,
/* Create fport instance. */
fport = create_file_list_port(pool, port_label);
if (!fport) {
status = PJ_ENOMEM;
goto on_error;
PJ_PERROR(4,(THIS_FILE, PJ_ENOMEM, "WAV playlist create failed"));
return PJ_ENOMEM;
}

fport->pool = pool;

afd = pjmedia_format_get_audio_format_detail(&fport->base.info.fmt, 1);
Expand Down Expand Up @@ -646,16 +647,18 @@ PJ_DEF(pj_status_t) pjmedia_wav_playlist_create(pj_pool_t *pool_,

on_error:

for (index=0; index<file_count; ++index) {
if (fport->fd_list[index] != 0)
pj_file_close(fport->fd_list[index]);
if (fport->fd_list) {
for (index=0; index<file_count; ++index) {
if (fport->fd_list[index] != 0)
pj_file_close(fport->fd_list[index]);
}
}

if (pool)
pj_pool_release(pool);

PJ_PERROR(1,(THIS_FILE, status,
"Failed creating WAV playlist '%s'",
"Failed creating WAV playlist '%.*s'",
(int)port_label->slen, port_label->ptr));

return status;
Expand Down

0 comments on commit f04b9de

Please sign in to comment.