Skip to content

AddrinfoStorage

Storage struct for contiguous addrinfo + sockaddr_in allocation.

addrinfo and sockaddr_in are allocated together to keep the ai_addr pointer valid after a single malloc/free. Using a struct (not union) ensures ai_family and sa.sin_addr.s_addr occupy separate memory, preventing the overlap bug where assigning ai_family = AF_INET (2) corrupted the resolved IP address on ARM64.

Type: struct addrinfo

Type: struct sockaddr_in