Fix potential Null pointer dereference in dns-example.c (#1601)

This commit is contained in:
icy17 2024-04-29 13:51:22 +08:00 committed by GitHub
parent a584efaa0e
commit 64decd48e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -196,7 +196,17 @@ main(int c, char **v) {
#endif
event_base = event_base_new();
if (event_base == NULL) {
fprintf(stderr, "Couldn't create new event_base\n");
return 1;
}
evdns_base = evdns_base_new(event_base, EVDNS_BASE_DISABLE_WHEN_INACTIVE);
if (evdns_base == NULL) {
event_base_free(event_base);
fprintf(stderr, "Couldn't create new evdns_base\n");
return 1;
}
evdns_set_log_fn(logfn);
if (o.servertest) {