You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/06/14 14:32:43 UTC

[GitHub] [incubator-nuttx-apps] xiaoxiang781216 opened a new pull request #765: netutils/webclient: fix the fd leak during connect(2) fail

xiaoxiang781216 opened a new pull request #765:
URL: https://github.com/apache/incubator-nuttx-apps/pull/765


   ## Summary
   Minor change in the fail path
   
   ## Impact
   Fix the resource leak in webclient
   
   ## Testing
   run webclient
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx-apps] xiaoxiang781216 closed pull request #765: netutils/webclient: fix the fd leak during connect(2) fail

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 closed pull request #765:
URL: https://github.com/apache/incubator-nuttx-apps/pull/765


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx-apps] gustavonihei commented on a change in pull request #765: netutils/webclient: fix the fd leak during connect(2) fail

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #765:
URL: https://github.com/apache/incubator-nuttx-apps/pull/765#discussion_r651124009



##########
File path: netutils/webclient/webclient.c
##########
@@ -903,8 +903,7 @@ int webclient_perform(FAR struct webclient_context *ctx)
       if (ret < 0)
         {
           nerr("ERROR: connect failed: %d\n", errno);
-          free(ws);
-          return ret;
+          goto errout_with_errno;

Review comment:
       Won't this end up closing the socket twice?
   In case `connect` fails, line 899 already closes the socket.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx-apps] gustavonihei commented on a change in pull request #765: netutils/webclient: fix the fd leak during connect(2) fail

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #765:
URL: https://github.com/apache/incubator-nuttx-apps/pull/765#discussion_r651124009



##########
File path: netutils/webclient/webclient.c
##########
@@ -903,8 +903,7 @@ int webclient_perform(FAR struct webclient_context *ctx)
       if (ret < 0)
         {
           nerr("ERROR: connect failed: %d\n", errno);
-          free(ws);
-          return ret;
+          goto errout_with_errno;

Review comment:
       Won't this end up closing the socket twice for the non-TLS path?
   In case `connect` fails, line 899 already closes the socket.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on a change in pull request #765: netutils/webclient: fix the fd leak during connect(2) fail

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #765:
URL: https://github.com/apache/incubator-nuttx-apps/pull/765#discussion_r651135745



##########
File path: netutils/webclient/webclient.c
##########
@@ -903,8 +903,7 @@ int webclient_perform(FAR struct webclient_context *ctx)
       if (ret < 0)
         {
           nerr("ERROR: connect failed: %d\n", errno);
-          free(ws);
-          return ret;
+          goto errout_with_errno;

Review comment:
       The code is changed recently, look like the leak is fixed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx-apps] gustavonihei commented on a change in pull request #765: netutils/webclient: fix the fd leak during connect(2) fail

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #765:
URL: https://github.com/apache/incubator-nuttx-apps/pull/765#discussion_r651124009



##########
File path: netutils/webclient/webclient.c
##########
@@ -903,8 +903,7 @@ int webclient_perform(FAR struct webclient_context *ctx)
       if (ret < 0)
         {
           nerr("ERROR: connect failed: %d\n", errno);
-          free(ws);
-          return ret;
+          goto errout_with_errno;

Review comment:
       Won't this end up closing the socket twice for the non-TLS path?
   In case `connect` fails, line 899 already closes the socket.
   Maybe this error checking should be moved to after `tls_ops->connect` on line 817.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org