1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-11-03 04:17:17 -05:00

Feature: Replaced free()-strdup() in event code with util_replace_string()

See: #2370
This commit is contained in:
Philipp Schafft 2019-01-09 09:29:56 +00:00
parent edd3dcc60d
commit a301a302ba
3 changed files with 4 additions and 16 deletions

View File

@ -275,10 +275,7 @@ int event_get_exec(event_registration_t *er, config_options_t *options) {
* <option name="default_arguments" value="..." /> (for values see near top of documment)
*/
if (strcmp(cur->name, "executable") == 0) {
free(self->executable);
self->executable = NULL;
if (cur->value)
self->executable = strdup(cur->value);
util_replace_string(&(self->executable), cur->value);
} else if (strcmp(cur->name, "default_arguments") == 0) {
self->argvtype = __str2argvtype(cur->value);
} else {

View File

@ -64,10 +64,7 @@ int event_get_log(event_registration_t *er, config_options_t *options) {
* <option name="level" value="..." />
*/
if (strcmp(options->name, "prefix") == 0) {
free(self->prefix);
self->prefix = NULL;
if (options->value)
self->prefix = strdup(options->value);
util_replace_string(&(self->prefix), options->value);
} else if (strcmp(options->name, "level") == 0) {
self->level = ICECAST_LOGLEVEL_INFO;
if (options->value)

View File

@ -122,19 +122,13 @@ int event_get_url(event_registration_t *er, config_options_t *options) {
* <option name="action" value="..." />
*/
if (strcmp(options->name, "url") == 0) {
free(self->url);
self->url = NULL;
if (options->value)
self->url = strdup(options->value);
util_replace_string(&(self->url), options->value);
} else if (strcmp(options->name, "username") == 0) {
username = options->value;
} else if (strcmp(options->name, "password") == 0) {
password = options->value;
} else if (strcmp(options->name, "action") == 0) {
free(self->action);
self->action = NULL;
if (options->value)
self->action = strdup(options->value);
util_replace_string(&(self->action), options->value);
} else {
ICECAST_LOG_ERROR("Unknown <option> tag with name %s.", options->name);
}