mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-04-22 07:30:50 +00:00
Add allocation of path on stack when linked_count is > 0
This commit is contained in:
parent
fe18b2b869
commit
c96acb01ed
1 changed files with 15 additions and 3 deletions
|
@ -1713,8 +1713,17 @@ fluid_mod_check_linked_mod(char *list_name,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* path allocation */
|
||||
path = FLUID_MALLOC (sizeof(*path) * mod_count);
|
||||
if(linked_count <= 0)
|
||||
{
|
||||
/* path allocation (in memory pool) */
|
||||
path = FLUID_MALLOC (sizeof(*path) * mod_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* path allocation (on stack) */
|
||||
path = alloca(sizeof(*path) * mod_count);
|
||||
}
|
||||
|
||||
if(path == NULL)
|
||||
{
|
||||
return FLUID_FAILED;
|
||||
|
@ -1800,7 +1809,10 @@ fluid_mod_check_linked_mod(char *list_name,
|
|||
}
|
||||
|
||||
/* free path */
|
||||
FLUID_FREE(path);
|
||||
if(linked_count <= 0)
|
||||
{
|
||||
FLUID_FREE(path);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue