Revert "Fix potential memory leak"

This reverts commit 50d34e5653ade4f3f1623c86f1426aeb746ae564.

- patch was breaking regression tests (test_many_sockets).