]> granicus.if.org Git - libevent/commitdiff
Fix some crash bugs when initializing evdns
authorNick Mathewson <nickm@torproject.org>
Wed, 14 Oct 2009 00:46:40 +0000 (00:46 +0000)
committerNick Mathewson <nickm@torproject.org>
Wed, 14 Oct 2009 00:46:40 +0000 (00:46 +0000)
svn:r1443

ChangeLog
evdns.c

index 459ec1b8094ceaf1de35853fbf256da2422c8736..68929ee62975af594f181cc4ed260804fc1abd9e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,7 @@ Changes in 2.0.3-alpha:
  o Do not drop data from evbuffer when out of memory; reported by Jacek Masiulaniec
  o New event_base_got_exit() and event_base_got_break() functions to tell whether an event loop exited because of an event_base_loopexit() or an event_base_loopbreak().  Patch from Ka-Hing Cheung.
  o When adding or deleting an event from a non-main thread, only wake up the main thread when its behavior actually needs to change.
+ o Fix some bugs when using the old evdns interfaces to initialize the evdns module.
 
 
 Changes in 2.0.2-alpha:
diff --git a/evdns.c b/evdns.c
index 60c836c1be6f28dbd32533438448e96d5e19d1c1..31cccdfbe93a074adc2287d0ba3a2a8e6bff8563 100644 (file)
--- a/evdns.c
+++ b/evdns.c
@@ -3228,6 +3228,8 @@ evdns_base_set_option_impl(struct evdns_base *base,
 int
 evdns_set_option(const char *option, const char *val, int flags)
 {
+       if (!current_base)
+               current_base = evdns_base_new(NULL, 0);
        return evdns_base_set_option(current_base, option, val, flags);
 }
 
@@ -3355,6 +3357,8 @@ out1:
 
 int
 evdns_resolv_conf_parse(int flags, const char *const filename) {
+       if (!current_base)
+               current_base = evdns_base_new(NULL, 0);
        return evdns_base_resolv_conf_parse(current_base, flags, filename);
 }
 
@@ -3574,7 +3578,6 @@ evdns_config_windows_nameservers(void)
        } else {
                return evdns_base_config_windows_nameservers(current_base);
        }
-        
 }
 #endif