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) { ...@@ -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) * <option name="default_arguments" value="..." /> (for values see near top of documment)
*/ */
if (strcmp(cur->name, "executable") == 0) { if (strcmp(cur->name, "executable") == 0) {
free(self->executable); util_replace_string(&(self->executable), cur->value);
self->executable = NULL;
if (cur->value)
self->executable = strdup(cur->value);
} else if (strcmp(cur->name, "default_arguments") == 0) { } else if (strcmp(cur->name, "default_arguments") == 0) {
self->argvtype = __str2argvtype(cur->value); self->argvtype = __str2argvtype(cur->value);
} else { } else {
......
...@@ -64,10 +64,7 @@ int event_get_log(event_registration_t *er, config_options_t *options) { ...@@ -64,10 +64,7 @@ int event_get_log(event_registration_t *er, config_options_t *options) {
* <option name="level" value="..." /> * <option name="level" value="..." />
*/ */
if (strcmp(options->name, "prefix") == 0) { if (strcmp(options->name, "prefix") == 0) {
free(self->prefix); util_replace_string(&(self->prefix), options->value);
self->prefix = NULL;
if (options->value)
self->prefix = strdup(options->value);
} else if (strcmp(options->name, "level") == 0) { } else if (strcmp(options->name, "level") == 0) {
self->level = ICECAST_LOGLEVEL_INFO; self->level = ICECAST_LOGLEVEL_INFO;
if (options->value) if (options->value)
......
...@@ -122,19 +122,13 @@ int event_get_url(event_registration_t *er, config_options_t *options) { ...@@ -122,19 +122,13 @@ int event_get_url(event_registration_t *er, config_options_t *options) {
* <option name="action" value="..." /> * <option name="action" value="..." />
*/ */
if (strcmp(options->name, "url") == 0) { if (strcmp(options->name, "url") == 0) {
free(self->url); util_replace_string(&(self->url), options->value);
self->url = NULL;
if (options->value)
self->url = strdup(options->value);
} else if (strcmp(options->name, "username") == 0) { } else if (strcmp(options->name, "username") == 0) {
username = options->value; username = options->value;
} else if (strcmp(options->name, "password") == 0) { } else if (strcmp(options->name, "password") == 0) {
password = options->value; password = options->value;
} else if (strcmp(options->name, "action") == 0) { } else if (strcmp(options->name, "action") == 0) {
free(self->action); util_replace_string(&(self->action), options->value);
self->action = NULL;
if (options->value)
self->action = strdup(options->value);
} else { } else {
ICECAST_LOG_ERROR("Unknown <option> tag with name %s.", options->name); 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