Merge pull request #2027 from signalwire/coverity_06042023_mod_event_multicast

[mod_event_multicast] Coverity CID 1468504 (Resource leak)
This commit is contained in:
Andrey Volk 2023-04-07 00:11:41 +03:00 committed by GitHub
commit 0091a90ea8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -153,16 +153,18 @@ static switch_status_t load_config(switch_xml_t input_cfg)
} }
if ((settings = switch_xml_child(cfg, "settings"))) { if ((settings = switch_xml_child(cfg, "settings"))) {
for (param = switch_xml_child(settings, "param"); param; param = param->next) { for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name"); char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value"); char *val = (char *) switch_xml_attr_soft(param, "value");
char *val_no_whitespace = switch_strip_whitespace(val);
if (!strcasecmp(var, "address")) { if (!strcasecmp(var, "address")) {
set_global_dst_addrs(switch_strip_whitespace(val)); set_global_dst_addrs(val_no_whitespace);
} else if (!strcasecmp(var, "source_address")) { } else if (!strcasecmp(var, "source_address")) {
set_global_src_addr(switch_strip_whitespace(val)); set_global_src_addr(val_no_whitespace);
} else if (!strcasecmp(var, "source_address_ipv6")) { } else if (!strcasecmp(var, "source_address_ipv6")) {
set_global_src_addr6(switch_strip_whitespace(val)); set_global_src_addr6(val_no_whitespace);
} else if (!strcasecmp(var, "bindings")) { } else if (!strcasecmp(var, "bindings")) {
set_global_bindings(val); set_global_bindings(val);
} else if (!strcasecmp(var, "port")) { } else if (!strcasecmp(var, "port")) {
@ -183,6 +185,8 @@ static switch_status_t load_config(switch_xml_t input_cfg)
} else if (!strcasecmp(var, "loopback")) { } else if (!strcasecmp(var, "loopback")) {
globals.loopback = switch_true(val); globals.loopback = switch_true(val);
} }
switch_safe_free(val_no_whitespace);
} }
} }
@ -190,6 +194,7 @@ static switch_status_t load_config(switch_xml_t input_cfg)
if (globals.bindings) { if (globals.bindings) {
for (cur = globals.bindings; cur; count++) { for (cur = globals.bindings; cur; count++) {
switch_event_types_t type; switch_event_types_t type;