From 66f6e5f048d15140ee2212213ef14b0e47eb987b Mon Sep 17 00:00:00 2001 From: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com> Date: Fri, 25 Feb 2022 14:22:28 +0900 Subject: [PATCH] netutils/webclient: Fix bug that the socket is not close Fix to close socket when it fails to resolve hostname. --- netutils/webclient/webclient.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/netutils/webclient/webclient.c b/netutils/webclient/webclient.c index ad744350b..feaa9235b 100644 --- a/netutils/webclient/webclient.c +++ b/netutils/webclient/webclient.c @@ -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;