Don't forget to remember previous element at the end of the loop.

Reported by:	brueffer
Found with:	Coverity Prevent(tm)
CID:		1135301
This commit is contained in:
Pawel Jakub Dawidek 2014-04-30 09:58:28 +00:00
parent 18f169af92
commit e51fc8f90d

View File

@ -247,6 +247,7 @@ cap_getaddrinfo(cap_channel_t *chan, const char *hostname, const char *servname,
prevai->ai_next = curai; prevai->ai_next = curai;
else if (firstai == NULL) else if (firstai == NULL)
firstai = curai; firstai = curai;
prevai = curai;
} }
nvlist_destroy(nvl); nvlist_destroy(nvl);
if (curai == NULL && nvlai != NULL) { if (curai == NULL && nvlai != NULL) {