FS-11903: Fix errors reported by PVS-Studio Static Code Analyzer for switch_core_codec.c
This commit is contained in:
parent
6f2568e6e8
commit
3018a76c10
|
@ -269,7 +269,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session->read_codec && session->read_impl.decoded_bytes_per_packet) {
|
if (session->read_impl.decoded_bytes_per_packet) {
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_channel_event_set_data(session->channel, event);
|
switch_channel_event_set_data(session->channel, event);
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", session->read_impl.iananame);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", session->read_impl.iananame);
|
||||||
|
@ -440,7 +440,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_codec(switch_core_
|
||||||
session->write_impl = *codec->implementation;
|
session->write_impl = *codec->implementation;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session->write_codec && codec && session->write_impl.codec_id) {
|
if (codec && session->write_impl.codec_id) {
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_channel_event_set_data(session->channel, event);
|
switch_channel_event_set_data(session->channel, event);
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", session->write_impl.iananame);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", session->write_impl.iananame);
|
||||||
|
@ -663,7 +663,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec
|
||||||
|
|
||||||
if (!strncasecmp(codec_name, "PROXY", 5)) {
|
if (!strncasecmp(codec_name, "PROXY", 5)) {
|
||||||
for (iptr = codec_interface->implementations; iptr; iptr = iptr->next) {
|
for (iptr = codec_interface->implementations; iptr; iptr = iptr->next) {
|
||||||
if ((!channels || channels == iptr->number_of_channels)) {
|
if (!channels || channels == iptr->number_of_channels) {
|
||||||
implementation = iptr;
|
implementation = iptr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -906,11 +906,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_control(switch_codec_t *codec,
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec)
|
SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec)
|
||||||
{
|
{
|
||||||
switch_mutex_t *mutex = codec->mutex;
|
switch_mutex_t *mutex = NULL;
|
||||||
switch_memory_pool_t *pool = codec->memory_pool;
|
switch_memory_pool_t *pool = NULL;
|
||||||
int free_pool = 0;
|
int free_pool = 0;
|
||||||
|
|
||||||
switch_assert(codec != NULL);
|
switch_assert(codec != NULL);
|
||||||
|
mutex = codec->mutex;
|
||||||
|
pool = codec->memory_pool;
|
||||||
|
|
||||||
if (mutex) switch_mutex_lock(mutex);
|
if (mutex) switch_mutex_lock(mutex);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue