[v9_12] Fix cleanup upon an error before TCP socket creation

Closes #692 (closed)

Merge request reports