Fix segmentation fault after evdns base resume (rebased)

I don't sure about
https://github.com/azat/libevent/pull/new/fix-segmentation-fault-after-evdns_base_resume-v2#L1R1785

So if you have some thoughts, please write.