소스 검색

Fix bug 1001

For compatibility with Libevent2, tor_event_new should accept
a NULL base without crashing.
Sebastian Hahn 16 년 전
부모
커밋
0caf8dd0b6
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      src/common/compat_libevent.c

+ 2 - 0
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;
 }