Fix small possible mem leak in new API