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

cppcheck complains about lib/asyn-ares.c:459 #5326

Closed
rl1987 opened this issue May 2, 2020 · 1 comment
Closed

cppcheck complains about lib/asyn-ares.c:459 #5326

rl1987 opened this issue May 2, 2020 · 1 comment
Labels
name lookup DNS and related tech

Comments

@rl1987
Copy link

rl1987 commented May 2, 2020

Ran cppcheck on curl master (2d137de) and got the following warning:

lib/asyn-thread.c:596:4: error: Null pointer dereference: entry [ctunullpointer]
  *entry = NULL;
   ^
lib/asyn-ares.c:459:39: note: Calling function Curl_resolver_is_resolved, 2nd argument is null
    result = Curl_resolver_is_resolved(conn, entry?&temp_entry:NULL);
                                      ^
lib/asyn-thread.c:596:4: note: Dereferencing argument entry that is null
  *entry = NULL;
   ^

As far as I can tell NULL pointer dereference cannot really happen, but this probably should be fixed anyway.

@jay jay closed this as completed in 153d581 May 2, 2020
@jay
Copy link
Member

jay commented May 2, 2020

Yes it cannot happen because those two are mutually exclusive, either the threaded or ares resolver is used and we have an internal resolver interface, so there is a Curl_resolver_is_resolved in both asyn-ares and asyn-thread. I fixed it anyway to silence cppcheck and make the interface consistent. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
name lookup DNS and related tech
Development

No branches or pull requests

2 participants