diff options
author | wiz <wiz@pkgsrc.org> | 2019-03-12 15:37:51 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2019-03-12 15:37:51 +0000 |
commit | b9d9fcde297b13ad29205408554251544893b2bd (patch) | |
tree | 7160fe50d4ad466c227031d08bb4ee709f8adfae /pkgtools | |
parent | d870c3fb700aeff7c785348eef6942d7597adb78 (diff) | |
download | pkgsrc-b9d9fcde297b13ad29205408554251544893b2bd.tar.gz |
pbulk-base: fix double free().
Debugged by dillo & myself.
Bump version.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pbulk-base/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pbulk/files/pbulk/lib/event.c | 14 |
2 files changed, 12 insertions, 6 deletions
diff --git a/pkgtools/pbulk-base/Makefile b/pkgtools/pbulk-base/Makefile index 9f5d68a90b5..d22197bcb23 100644 --- a/pkgtools/pbulk-base/Makefile +++ b/pkgtools/pbulk-base/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.24 2016/06/23 15:07:39 joerg Exp $ +# $NetBSD: Makefile,v 1.25 2019/03/12 15:37:51 wiz Exp $ -DISTNAME= pbulk-base-0.53 +DISTNAME= pbulk-base-0.54 COMMENT= Core components of the modular bulk build framework .include "../../pkgtools/pbulk/Makefile.common" diff --git a/pkgtools/pbulk/files/pbulk/lib/event.c b/pkgtools/pbulk/files/pbulk/lib/event.c index 32e563828f8..bb29d93277f 100644 --- a/pkgtools/pbulk/files/pbulk/lib/event.c +++ b/pkgtools/pbulk/files/pbulk/lib/event.c @@ -1,4 +1,4 @@ -/* $NetBSD: event.c,v 1.8 2017/02/25 21:21:53 joerg Exp $ */ +/* $NetBSD: event.c,v 1.9 2019/03/12 15:37:51 wiz Exp $ */ /*- * Copyright (c) 2007, 2009 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -51,6 +51,8 @@ #include "pbulk.h" +static struct event *poll_loop_next = NULL; + struct deferred_read_arg { void *cb_arg; void (*cb_ok)(void *); @@ -206,6 +208,9 @@ event_add(struct event *ev, int fd, int do_write, int is_persistent, void event_del(struct event *ev) { + if (ev == poll_loop_next) { + poll_loop_next = LIST_NEXT(ev, ev_link); + } LIST_REMOVE(ev, ev_link); --active_events; } @@ -303,7 +308,7 @@ void event_dispatch(void) { struct timeval now; - struct event *ev, *next; + struct event *ev; struct pollfd *iter, *last_iter; int ret, timeout; @@ -345,8 +350,8 @@ loop: if (ret > 0) { iter = poll_list; for (ev = LIST_FIRST(&all_events); - iter < last_iter && ev && (next = LIST_NEXT(ev, ev_link), 1); - ev = next, ++iter) { + iter < last_iter && ev && (poll_loop_next = LIST_NEXT(ev, ev_link), 1); + ev = poll_loop_next, ++iter) { if (iter->revents) { if (!ev->ev_persistent) { --active_events; @@ -356,6 +361,7 @@ loop: --ret; } } + poll_loop_next = NULL; } goto loop; } |