Fix: freeing previous elements has to be done before loading new parameters to avoid trying to delete unexisting objects if arrays size was modified
Merge pull request #2108 from pemmanuelviel:flannMemoryLeak