Fix a crash during concurrent sessions TIMEOUT reported by James
Turner (#5).
imsgev_close schedules(event_add) iev and the event struct is free-ed
before the event is dispatched.
Include string.h after recent libressl changes.
--- a/pop3d.c Fri May 02 19:17:38 2014 +0500
+++ b/pop3d.c Wed May 28 16:37:41 2014 +0500
@@ -201,7 +201,6 @@
case SIGHUP:
case SIGTERM:
imsgev_clear(&iev_pop3e);
- imsgev_close(&iev_pop3e);
event_loopexit(NULL);
break;
case SIGCHLD:
--- a/session.c Fri May 02 19:17:38 2014 +0500
+++ b/session.c Wed May 28 16:37:41 2014 +0500
@@ -22,6 +22,7 @@
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <syslog.h>
#include <unistd.h>
@@ -147,7 +148,6 @@
iobuf_clear(&entry->iobuf);
io_clear(&entry->io);
imsgev_clear(&entry->iev_maildrop);
- imsgev_close(&entry->iev_maildrop);
logit(LOG_INFO, "%u: session closed", entry->id);
free(entry);
}