diff --git a/src/lib/core/coio.c b/src/lib/core/coio.c
index 57caadeae35301009556bf928bc9a34b11b4434d..3b8a5bd8e940076825b53e5a21a69e5bea7d43b2 100644
--- a/src/lib/core/coio.c
+++ b/src/lib/core/coio.c
@@ -171,7 +171,7 @@ coio_connect_timeout(const char *host, const char *service, int host_hint,
 	if (host != NULL && service != NULL && host_hint != 0) {
 		if (coio_fill_addrinfo(&ai_local, host, service,
 				       host_hint) != 0)
-			return -1;
+			goto out;
 		ai = &ai_local;
 	} else {
 		struct addrinfo hints;