Fix subtle memory leak because of order of struct initialisation.