Empty array before filling it in functions.

Attempt to fix Redmine 6369