[or-cvs] [tor/master] Fix bug 1001

Nick Mathewson nickm at seul.org
Tue Jun 16 18:34:34 UTC 2009


Author: Sebastian Hahn <sebastian at torproject.org>
Date: Tue, 16 Jun 2009 17:30:08 +0200
Subject: Fix bug 1001
Commit: 0caf8dd0b6b047e0cc050837b2eea1746c508a5d

For compatibility with Libevent2, tor_event_new should accept
a NULL base without crashing.
---
 src/common/compat_libevent.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
index 73308b4..793e174 100644
--- a/src/common/compat_libevent.c
+++ b/src/common/compat_libevent.c
@@ -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;
 }
-- 
1.5.6.5



More information about the tor-commits mailing list