The dom_info struct is not allocated before use. Move the fucntion xc_domain_getinfolist code after dom_info = malloc(sizeof(xc_domaininfo_t))