Fix memory leaks when generating message list

It turned out that the values returned from ml_tree_value_at_ex() can
be dynamically allocated, thus proper free functions should be called
for these too.