[Core] Coverity: Dereference before null check

* [Core] Coverity: 1060958 Dereference before null check

* [Core] Coverity: 1024236 Dereference before null check
This commit is contained in:
Andrey Volk 2023-10-05 00:26:26 +03:00 committed by GitHub
parent c4115537e0
commit 79ce088101
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -2814,11 +2814,13 @@ SWITCH_DECLARE(int) switch_ivr_set_xml_call_stats(switch_xml_t xml, switch_core_
static int switch_ivr_set_xml_chan_var(switch_xml_t xml, const char *var, const char *val, int off)
{
char *data;
switch_size_t dlen = strlen(val) * 3 + 1;
switch_size_t dlen;
switch_xml_t variable;
if (!val) val = "";
dlen = strlen(val) * 3 + 1;
if (!zstr(var) && ((variable = switch_xml_add_child_d(xml, var, off++)))) {
if ((data = malloc(dlen))) {
memset(data, 0, dlen);

View File

@ -1309,7 +1309,7 @@ static switch_status_t setup_ringback(originate_global_t *oglobals, originate_st
}
}
if (oglobals->session && (read_codec = switch_core_session_get_read_codec(oglobals->session))) {
if ((read_codec = switch_core_session_get_read_codec(oglobals->session))) {
if (ringback_data && switch_is_file_path(ringback_data)) {
if (!(strrchr(ringback_data, '.') || strstr(ringback_data, SWITCH_URL_SEPARATOR))) {
ringback->asis++;