mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-13 06:33:44 +01:00
scan-build: Add a check for result from getaddrinfo
As documented, getaddrinfo always sets its result when it returns no error. But scan-build doesn't know that, and thinks we might be def
This commit is contained in:
parent
0cca8dc35a
commit
08325b58be
@ -236,7 +236,9 @@ tor_addr_lookup(const char *name, uint16_t family, tor_addr_t *addr)
|
|||||||
hints.ai_family = family;
|
hints.ai_family = family;
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
hints.ai_socktype = SOCK_STREAM;
|
||||||
err = sandbox_getaddrinfo(name, NULL, &hints, &res);
|
err = sandbox_getaddrinfo(name, NULL, &hints, &res);
|
||||||
if (!err) {
|
/* The check for 'res' here shouldn't be necessary, but it makes static
|
||||||
|
* analysis tools happy. */
|
||||||
|
if (!err && res) {
|
||||||
best = NULL;
|
best = NULL;
|
||||||
for (res_p = res; res_p; res_p = res_p->ai_next) {
|
for (res_p = res; res_p; res_p = res_p->ai_next) {
|
||||||
if (family == AF_UNSPEC) {
|
if (family == AF_UNSPEC) {
|
||||||
|
Loading…
Reference in New Issue
Block a user