aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2009-06-16 17:30:08 +0200
committerSebastian Hahn <sebastian@torproject.org>2009-06-16 17:30:08 +0200
commit0caf8dd0b6b047e0cc050837b2eea1746c508a5d (patch)
tree89dcd422bf5b975b44073d206af6f06d856b22b7
parentbdd5785f075d89123f6ac8110ea86f31981ae3b1 (diff)
downloadtor-0caf8dd0b6b047e0cc050837b2eea1746c508a5d.tar.gz
tor-0caf8dd0b6b047e0cc050837b2eea1746c508a5d.zip
Fix bug 1001
For compatibility with Libevent2, tor_event_new should accept a NULL base without crashing.
-rw-r--r--src/common/compat_libevent.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
index 73308b4eab..793e174477 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;
}