Clear out previous legend array contents before freeing legend array.