Intramedullary nailing is used in the treatment of: