netutils/webclient: Fix bug that the socket is not close

Fix to close socket when it fails to resolve hostname.
This commit is contained in:
SPRESENSE 2022-02-25 14:22:28 +09:00 committed by Xiang Xiao
parent 913792c7be
commit 66f6e5f048

View File

@ -1596,9 +1596,8 @@ int webclient_perform(FAR struct webclient_context *ctx)
/* Could not resolve host (or malformed IP address) */
nwarn("WARNING: Failed to resolve hostname\n");
free_ws(ws);
_SET_STATE(ctx, WEBCLIENT_CONTEXT_STATE_DONE);
return -EHOSTUNREACH;
ret = -EHOSTUNREACH;
goto errout_with_errno;
}
server_address = (const struct sockaddr *)&server_in;