2.x Fix resource leak in client registration path.