Fix resource leak in client registration path.
Merge pull request #289 from tbak/2.x

2.x Fix resource leak in client registration path.