]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix bug 1001
authorSebastian Hahn <sebastian@torproject.org>
Tue, 16 Jun 2009 15:30:08 +0000 (17:30 +0200)
committerSebastian Hahn <sebastian@torproject.org>
Tue, 16 Jun 2009 15:30:08 +0000 (17:30 +0200)
For compatibility with Libevent2, tor_event_new should accept
a NULL base without crashing.

src/common/compat_libevent.c

index 73308b4eabe07baa759245b48b42c8a8cbcaa38c..793e17447721cf012a77d7a3b6f3aad92c06bbdd 100644 (file)
@@ -114,6 +114,8 @@ tor_event_new(struct event_base *base, int sock, short what,
 {
   struct event *e = tor_malloc_zero(sizeof(struct event));
   event_set(e, sock, what, cb, arg);
+  if (! base)
+    base = tor_libevent_get_base();
   event_base_set(base, e);
   return e;
 }