summaryrefslogtreecommitdiffstats
path: root/lib/libevent
diff options
context:
space:
mode:
authorbrad <brad@openbsd.org>2006-11-05 03:39:40 +0000
committerbrad <brad@openbsd.org>2006-11-05 03:39:40 +0000
commit7fea9e64e32b0621d48e1591fc98503ea3d96fd2 (patch)
tree6c0072ad19d983ce5b2338ee4ca914f16217854c /lib/libevent
parentANSI (diff)
downloadwireguard-openbsd-7fea9e64e32b0621d48e1591fc98503ea3d96fd2.tar.xz
wireguard-openbsd-7fea9e64e32b0621d48e1591fc98503ea3d96fd2.zip
fix a potential memory leak in event_once().
From Niels Provos via the libevent SVN repo, by Scott Lamb tested by niallo@ ok deraadt@
Diffstat (limited to 'lib/libevent')
-rw-r--r--lib/libevent/event.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libevent/event.c b/lib/libevent/event.c
index fc77faf1964..13049b286c9 100644
--- a/lib/libevent/event.c
+++ b/lib/libevent/event.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: event.c,v 1.13 2006/03/30 06:32:36 brad Exp $ */
+/* $OpenBSD: event.c,v 1.14 2006/11/05 03:39:40 brad Exp $ */
/*
* Copyright (c) 2000-2004 Niels Provos <provos@citi.umich.edu>
@@ -458,6 +458,7 @@ event_once(int fd, short events,
{
struct event_once *eonce;
struct timeval etv;
+ int res;
/* We cannot support signals that just fire once */
if (events & EV_SIGNAL)
@@ -486,7 +487,11 @@ event_once(int fd, short events,
return (-1);
}
- event_add(&eonce->ev, tv);
+ res = event_add(&eonce->ev, tv);
+ if (res != 0) {
+ free(eonce);
+ return (res);
+ }
return (0);
}