mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-17 17:22:21 +00:00
[Core] Fix a false-positive memory leak detected by scan-build in switch_channel_set_variable_strip_quotes_var_check()
This commit is contained in:
parent
c58b659f3f
commit
b9fdf00f6f
@ -1511,11 +1511,12 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_strip_quotes_var_che
|
|||||||
int ok = 1;
|
int ok = 1;
|
||||||
char *t = (char *)value;
|
char *t = (char *)value;
|
||||||
char *r = (char *)value;
|
char *r = (char *)value;
|
||||||
|
char *tmp = NULL;
|
||||||
|
|
||||||
if (t && *t == '"') {
|
if (t && *t == '"') {
|
||||||
t++;
|
t++;
|
||||||
if (end_of(t) == '"') {
|
if (end_of(t) == '"') {
|
||||||
r = strdup(t);
|
r = tmp = strdup(t);
|
||||||
switch_assert(r);
|
switch_assert(r);
|
||||||
end_of(r) = '\0';
|
end_of(r) = '\0';
|
||||||
}
|
}
|
||||||
@ -1530,7 +1531,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_strip_quotes_var_che
|
|||||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_CRIT, "Invalid data (${%s} contains a variable)\n", varname);
|
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_CRIT, "Invalid data (${%s} contains a variable)\n", varname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r != value) free(r);
|
switch_safe_free(tmp);
|
||||||
}
|
}
|
||||||
status = SWITCH_STATUS_SUCCESS;
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user