From: Nick Mathewson Date: Wed, 8 Jun 2011 18:29:36 +0000 (-0400) Subject: Merge remote-tracking branch 'origin/patches-2.0' X-Git-Tag: release-2.1.1-alpha~253 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5099d858b1906bad04c531a7c98e2d0877d5e7f8;p=libevent Merge remote-tracking branch 'origin/patches-2.0' --- 5099d858b1906bad04c531a7c98e2d0877d5e7f8 diff --cc event.c index 62ec7f54,27bf3dc3..18de9137 --- a/event.c +++ b/event.c @@@ -682,15 -681,21 +682,21 @@@ event_base_free(struct event_base *base /* XXXX grab the lock? If there is contention when one thread frees * the base, then the contending thread will be very sad soon. */ + /* event_base_free(NULL) is how to free the current_base if we + * made it with event_init and forgot to hold a reference to it. */ if (base == NULL && current_base) base = current_base; + /* If we're freeing current_base, there won't be a current_base. */ if (base == current_base) current_base = NULL; - + /* Don't actually free NULL. */ + if (base == NULL) { + event_warnx("%s: no base to free", __func__); + return; + } /* XXX(niels) - check for internal events first */ - EVUTIL_ASSERT(base); -#ifdef WIN32 +#ifdef _WIN32 event_base_stop_iocp(base); #endif