summaryrefslogtreecommitdiff
path: root/lib/libevent/select.c
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2006-03-30 06:32:37 +0000
committerBrad Smith <brad@cvs.openbsd.org>2006-03-30 06:32:37 +0000
commitfcff593da564d69c00a6a0bf92b97c16f4311ce1 (patch)
tree134f6ee2805e71107ed05e36a3706f5d9ed7b02f /lib/libevent/select.c
parentb7aa5de49394fb2cccba24b4beb9a06d28c8058a (diff)
introduce a way to free the base.
From libevent CVS
Diffstat (limited to 'lib/libevent/select.c')
-rw-r--r--lib/libevent/select.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/lib/libevent/select.c b/lib/libevent/select.c
index 48ab2e3ec0c..f3efa390f6e 100644
--- a/lib/libevent/select.c
+++ b/lib/libevent/select.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: select.c,v 1.11 2005/06/18 01:52:22 brad Exp $ */
+/* $OpenBSD: select.c,v 1.12 2006/03/30 06:32:36 brad Exp $ */
/*
* Copyright 2000-2002 Niels Provos <provos@citi.umich.edu>
@@ -76,6 +76,7 @@ int select_add (void *, struct event *);
int select_del (void *, struct event *);
int select_recalc (struct event_base *, void *, int);
int select_dispatch (struct event_base *, void *, struct timeval *);
+void select_dealloc (void *);
const struct eventop selectops = {
"select",
@@ -83,7 +84,8 @@ const struct eventop selectops = {
select_add,
select_del,
select_recalc,
- select_dispatch
+ select_dispatch,
+ select_dealloc
};
static int select_resize(struct selectop *sop, int fdsz);
@@ -350,3 +352,25 @@ select_del(void *arg, struct event *ev)
check_selectop(sop);
return (0);
}
+
+void
+select_dealloc(void *arg)
+{
+ struct selectop *sop = arg;
+
+ if (sop->event_readset_in)
+ free(sop->event_readset_in);
+ if (sop->event_writeset_in)
+ free(sop->event_writeset_in);
+ if (sop->event_readset_out)
+ free(sop->event_readset_out);
+ if (sop->event_writeset_out)
+ free(sop->event_writeset_out);
+ if (sop->event_r_by_fd)
+ free(sop->event_r_by_fd);
+ if (sop->event_w_by_fd)
+ free(sop->event_w_by_fd);
+
+ memset(sop, 0, sizeof(struct selectop));
+ free(sop);
+}