vec: remove code duplication for destructors