I have a program that get IP of list of domains in a txt a huge list like millions of domains by gethostbyname and put them in struct sockaddr_in and I use multithreading to make the process faster the check them all after working for 4 or 5 mintues i get segmentation fault exactly in the memcpy code
It is a linux code
Example of the main routine of all the threads:
#include <netdb.h>
#include <arpa/inet.h>
void* startcheckingdomains(){
    while(1){
        char* domain = "www.google.com";
        struct hostent* hp = gethostbyname(domain);
        struct sockaddr_in sockaddr;
        if(hp == NULL){
            herror("hp");
        }else{
            memcpy(&sockaddr.sin_addr,hp->h_addr,hp->h_length);
        }
    }
}
This is the error produced by gdb:
Thread 535 "main" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffe8f606700 (LWP 27402)]
__memmove_avx_unaligned_erms ()
