roles_in_group can be used from an in-place split since we don't need to store it. CID: 1352053 --- src/modules/stream-interaction.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modules/stream-interaction.c b/src/modules/stream-interaction.c index 7a476c3..c787544 100644 --- a/src/modules/stream-interaction.c +++ b/src/modules/stream-interaction.c @@ -396,10 +396,11 @@ int pa_stream_interaction_init(pa_module *m, const char* const v_modargs[]) { roles = pa_modargs_get_value(ma, "trigger_roles", NULL); if (roles) { const char *group_split_state = NULL; - char *roles_in_group = NULL; + const char *roles_in_group = NULL; + int l; i = 0; - while ((roles_in_group = pa_split(roles, "/", &group_split_state))) { - if (roles_in_group[0] != '\0') { + while ((roles_in_group = pa_split_in_place(roles, "/", &l, &group_split_state))) { + if (l > 0) { const char *split_state = NULL; char *n = NULL; while ((n = pa_split(roles_in_group, ",", &split_state))) { @@ -414,7 +415,6 @@ int pa_stream_interaction_init(pa_module *m, const char* const v_modargs[]) { i++; } else { pa_log("empty trigger roles"); - pa_xfree(roles_in_group); goto fail; } } @@ -427,10 +427,11 @@ int pa_stream_interaction_init(pa_module *m, const char* const v_modargs[]) { roles = pa_modargs_get_value(ma, u->duck ? "ducking_roles" : "cork_roles", NULL); if (roles) { const char *group_split_state = NULL; - char *roles_in_group = NULL; + const char *roles_in_group = NULL; + int l; i = 0; - while ((roles_in_group = pa_split(roles, "/", &group_split_state))) { - if (roles_in_group[0] != '\0') { + while ((roles_in_group = pa_split_in_place(roles, "/", &l, &group_split_state))) { + if (l > 0) { const char *split_state = NULL; char *n = NULL; while ((n = pa_split(roles_in_group, ",", &split_state))) { @@ -445,7 +446,6 @@ int pa_stream_interaction_init(pa_module *m, const char* const v_modargs[]) { i++; } else { pa_log("empty ducking roles"); - pa_xfree(roles_in_group); goto fail; } } -- 2.7.4