mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-02-18 18:11:05 +00:00
Fix a double-free when issuing the info command on string setting
Fixes #756.
This commit is contained in:
parent
fff51822eb
commit
4b5afca76c
1 changed files with 7 additions and 18 deletions
|
@ -1914,14 +1914,10 @@ fluid_handle_get(void *data, int ac, char **av, fluid_ostream_t out)
|
|||
|
||||
case FLUID_STR_TYPE:
|
||||
{
|
||||
char *s;
|
||||
char *s = NULL;
|
||||
fluid_settings_dupstr(handler->synth->settings, av[0], &s); /* ++ alloc string */
|
||||
fluid_ostream_printf(out, "%s\n", s ? s : "NULL");
|
||||
|
||||
if(s)
|
||||
{
|
||||
FLUID_FREE(s); /* -- free string */
|
||||
}
|
||||
FLUID_FREE(s); /* -- free string */
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -1999,14 +1995,10 @@ static void fluid_handle_settings_iter2(void *data, const char *name, int type)
|
|||
|
||||
case FLUID_STR_TYPE:
|
||||
{
|
||||
char *s;
|
||||
char *s = NULL;
|
||||
fluid_settings_dupstr(d->synth->settings, name, &s); /* ++ alloc string */
|
||||
fluid_ostream_printf(d->out, "%s\n", s ? s : "NULL");
|
||||
|
||||
if(s)
|
||||
{
|
||||
FLUID_FREE(s); /* -- free string */
|
||||
}
|
||||
FLUID_FREE(s); /* -- free string */
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -2133,19 +2125,16 @@ fluid_handle_info(void *d, int ac, char **av, fluid_ostream_t out)
|
|||
|
||||
case FLUID_STR_TYPE:
|
||||
{
|
||||
char *s;
|
||||
char *s = NULL;
|
||||
fluid_settings_dupstr(settings, av[0], &s); /* ++ alloc string */
|
||||
fluid_ostream_printf(out, "%s:\n", av[0]);
|
||||
fluid_ostream_printf(out, "Type: string\n");
|
||||
fluid_ostream_printf(out, "Value: %s\n", s ? s : "NULL");
|
||||
FLUID_FREE(s); /* -- free string */
|
||||
|
||||
fluid_settings_getstr_default(settings, av[0], &s);
|
||||
fluid_ostream_printf(out, "Default value: %s\n", s);
|
||||
|
||||
if(s)
|
||||
{
|
||||
FLUID_FREE(s);
|
||||
}
|
||||
|
||||
data.out = out;
|
||||
data.first = 1;
|
||||
fluid_ostream_printf(out, "Options: ");
|
||||
|
|
Loading…
Reference in a new issue