Skip to content

socket handling and WIN32 WSACleanup fixes - #3663

Closed
andyguibert wants to merge 3 commits into
curl:masterfrom
andyguibert:master
Closed

andyguibert wants to merge 3 commits into
curl:masterfrom
andyguibert:master

Conversation

@andyguibert

Copy link
Copy Markdown

Just a couple of nitpicks in docs/examples/externalsocket.c:

In the event that servaddr.sin_addr.s_addr is INADDR_NONE, the example code leaks sockfd. This would matter if someone copied the code into a function that wasn't main()... ;-)

Microsoft's Winsock documentation states that a matching call to WSACleanup() should be called for every WSAStartup() call performed.

Andre Guibert de Bruet added 2 commits March 10, 2019 23:15
…s a missing call to WSACleanup() in the WIN32

case, per Microsoft's Winsock2 documentation:
   https://docs.microsoft.com/en-us/windows/desktop/api/winsock/nf-winsock-wsacleanup

WSACleanup() should ideally be called before any return from main() that occurs after the call to WSAStartup().
   https://docs.microsoft.com/en-us/windows/desktop/api/winsock/nf-winsock-wsacleanup

WSACleanup() should ideally be called before any return from main() that occurs after the call to WSAStartup().
Comment thread docs/examples/externalsocket.c
@bagder

bagder commented Mar 11, 2019

Copy link
Copy Markdown
Member

Try make checksrc in the examples dir:

./externalsocket.c:163:4: warning: Trailing whitespace (TRAILINGSPACE)
     
    ^
checksrc: 0 errors and 1 warnings

@andyguibert

Copy link
Copy Markdown
Author

Try make checksrc in the examples dir:

./externalsocket.c:163:4: warning: Trailing whitespace (TRAILINGSPACE)
     
    ^
checksrc: 0 errors and 1 warnings

Corrected. Thanks!

@jay jay closed this in 57c7076 Mar 12, 2019
@jay

jay commented Mar 12, 2019

Copy link
Copy Markdown
Member

Thanks

@lock lock Bot locked as resolved and limited conversation to collaborators Jun 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants