Fix memory leak found by vlj