tevent: don't crash if te->event_ctx is NULL
authorStefan Metzmacher <metze@samba.org>
Mon, 5 Jan 2009 18:22:22 +0000 (19:22 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 5 Jan 2009 21:44:54 +0000 (22:44 +0100)
metze

lib/tevent/tevent_timed.c

index dadd360416419e745338c8564ca02244b788b84d..78c8a24511a8002c8953136147652ad082d3318b 100644 (file)
@@ -108,9 +108,9 @@ bool ev_timeval_is_zero(const struct timeval *tv)
 */
 static int tevent_common_timed_destructor(struct tevent_timer *te)
 {
-       struct tevent_context *ev = talloc_get_type(te->event_ctx,
-                                                  struct tevent_context);
-       DLIST_REMOVE(ev->timer_events, te);
+       if (te->event_ctx) {
+               DLIST_REMOVE(te->event_ctx->timer_events, te);
+       }
        return 0;
 }