On Wed, 2016-08-10 at 21:25 +0530, Arun Raghavan wrote: > 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))) { roles_in_group isn't NULL-terminated if you use pa_split_in_place(), but pa_split() assumes that it is NULL-terminated. --Â Tanu