fix mem leak in test