2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Add missing malloc failure check

Correctly NULL second entry in he->h_addr_list on get*byaddr.
This commit is contained in:
Mark Andrews
2000-02-01 01:58:26 +00:00
parent 60e0b5df02
commit c4cc75482f

View File

@@ -625,11 +625,13 @@ hostfromaddr(lwres_gnbaresponse_t *addr, int af, const void *src) {
/* copy address */
he->h_addr_list = malloc(sizeof(char *) * 2);
if (he->h_addr_list == NULL)
goto cleanup;
he->h_addr_list[0] = malloc(he->h_length);
if (he->h_addr_list[0] == NULL)
goto cleanup;
memcpy(he->h_addr_list[0], src, he->h_length);
he->h_addr_list[i] = NULL;
he->h_addr_list[1] = NULL;
return (he);
cleanup: