Fix null pointer refrence in event context in backport from v3-3-test
authorBo Yang <boyang@novell.com>
Mon, 12 Jan 2009 06:15:00 +0000 (14:15 +0800)
committerJeremy Allison <jra@samba.org>
Mon, 12 Jan 2009 07:47:35 +0000 (23:47 -0800)
Signed-off-by: Bo Yang <boyang@novell.com>
source/lib/events.c

index 43ca8df6209f337b55615439063f86bfe57fa4a6..fadb15e2d56cfd58e2ff00f4368ab15a69df6a3a 100644 (file)
@@ -64,7 +64,9 @@ static int timed_event_destructor(struct timed_event *te)
 {
        DEBUG(10, ("Destroying timed event %lx \"%s\"\n", (unsigned long)te,
                te->event_name));
-       DLIST_REMOVE(te->event_ctx->timed_events, te);
+       if (te->event_ctx) {
+               DLIST_REMOVE(te->event_ctx->timed_events, te);
+       }
        return 0;
 }
 
@@ -134,7 +136,9 @@ static int fd_event_destructor(struct fd_event *fde)
 {
        struct event_context *event_ctx = fde->event_ctx;
 
-       DLIST_REMOVE(event_ctx->fd_events, fde);
+       if (event_ctx) {
+               DLIST_REMOVE(event_ctx->fd_events, fde);
+       }
        return 0;
 }