[mod_vlc] scan-build: multiple dereferences of a null pointer

This commit is contained in:
Dragos Oancea 2020-02-27 11:48:56 +00:00
parent 2d727b7b31
commit e04c8ee92e

View File

@ -274,6 +274,8 @@ static void vlc_media_av_state_callback(const libvlc_event_t * event, void * dat
if (!(vcontext = acontext->vcontext)) {
return;
}
} else {
return;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Got a libvlc_MediaStateChanged callback. New state: %d\n", new_state);
@ -357,6 +359,8 @@ void vlc_file_play_audio_callback(void *data, const void *samples, unsigned coun
if (!(vcontext = acontext->vcontext)) {
return;
}
} else {
return;
}
switch_mutex_lock(vcontext->audio_mutex);
@ -585,14 +589,14 @@ static switch_status_t av_init_handle(switch_file_handle_t *handle, switch_image
int32_t offset = 250;
const char *tmp;
vlc_file_context_t *acontext = handle->private_info;
const char * opts[25] = {
*vlc_args,
switch_core_sprintf(acontext->pool, "--sout=%s", acontext->path)
};
const char * opts[25] = {0};
int argc = 2;
vlc_video_context_t *vcontext;
opts[0] = *vlc_args;
if (acontext) opts[1] = switch_core_sprintf(acontext->pool, "--sout=%s", acontext->path);
vcontext = acontext->vcontext;
pool = acontext->pool;
@ -963,9 +967,11 @@ static switch_status_t vlc_file_av_read(switch_file_handle_t *handle, void *data
if (!(vcontext = acontext->vcontext)) {
return SWITCH_STATUS_FALSE;
}
} else {
return SWITCH_STATUS_FALSE;
}
if (vcontext->err) {
if (vcontext && vcontext->err) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VLC ended\n");
return SWITCH_STATUS_GENERR;
}
@ -1122,6 +1128,8 @@ static switch_status_t vlc_file_read_video(switch_file_handle_t *handle, switch_
if (!(vcontext = acontext->vcontext)) {
return SWITCH_STATUS_FALSE;
}
} else {
return SWITCH_STATUS_FALSE;
}
if (vcontext->err) {