Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netrc: Return the correct error code when out of memory #4036

Closed

Conversation

@captain-caveman2k
Copy link
Member

commented Jun 18, 2019

Prior to this change Curl_parsenetrc() would return 27 if the strdup() of pwdir failed even though a) the function is declared to return an int and CURLE_OUT_OF_MEMORY is an enum, and b) the description in the header file is the function "returns -1 on failure, 0 if the host is found, 1 is the host isn't found"

The knock on effect is that libcurl would attempt to info "Couldn't find host www.example.com in the .netrc file; using defaults" and continue running rather than erroring with a CURLE_OUT_OF_MEMORY code straight away.

However, the chances that curl or any application developed with libcurl continuing after a memory allocation failure is very low and would presumably return the correct error code on the next allocation failure.

@bagder

bagder approved these changes Jun 18, 2019

@captain-caveman2k captain-caveman2k deleted the captain-caveman2k:netrc-result-code branch Jun 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.