Commit a301a302 authored by Philipp Schafft's avatar Philipp Schafft 🦁

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

See: #2370
parent edd3dcc6
......@@ -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 {
......
......@@ -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)
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment