Fix memory leak in output groups.