summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNayden Markatchev <nayden@cvs.openbsd.org>2016-09-03 11:31:18 +0000
committerNayden Markatchev <nayden@cvs.openbsd.org>2016-09-03 11:31:18 +0000
commit586d6802973fd357343efbcb816b70098f5d5422 (patch)
tree1f19a89afafafb518fb9fc3bd9df770714b065a7 /lib
parent10188799fae4fc7836648877792a0501814537d3 (diff)
Remove NULL pointer checks before calls to free().
OK bluhm@ nicm@
Diffstat (limited to 'lib')
-rw-r--r--lib/libevent/buffer.c5
-rw-r--r--lib/libevent/kqueue.c8
-rw-r--r--lib/libevent/poll.c14
-rw-r--r--lib/libevent/select.c20
4 files changed, 17 insertions, 30 deletions
diff --git a/lib/libevent/buffer.c b/lib/libevent/buffer.c
index 77685844b69..14f0cd9762b 100644
--- a/lib/libevent/buffer.c
+++ b/lib/libevent/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.29 2015/02/05 12:59:57 millert Exp $ */
+/* $OpenBSD: buffer.c,v 1.30 2016/09/03 11:31:17 nayden Exp $ */
/*
* Copyright (c) 2002, 2003 Niels Provos <provos@citi.umich.edu>
@@ -56,8 +56,7 @@ evbuffer_new(void)
void
evbuffer_free(struct evbuffer *buffer)
{
- if (buffer->orig_buffer != NULL)
- free(buffer->orig_buffer);
+ free(buffer->orig_buffer);
free(buffer);
}
diff --git a/lib/libevent/kqueue.c b/lib/libevent/kqueue.c
index 82a0c7e6f17..47966680bfc 100644
--- a/lib/libevent/kqueue.c
+++ b/lib/libevent/kqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kqueue.c,v 1.38 2015/12/25 17:10:05 tedu Exp $ */
+/* $OpenBSD: kqueue.c,v 1.39 2016/09/03 11:31:17 nayden Exp $ */
/*
* Copyright 2000-2002 Niels Provos <provos@citi.umich.edu>
@@ -420,10 +420,8 @@ kq_dealloc(struct event_base *base, void *arg)
evsignal_dealloc(base);
- if (kqop->changes)
- free(kqop->changes);
- if (kqop->events)
- free(kqop->events);
+ free(kqop->changes);
+ free(kqop->events);
if (kqop->kq >= 0 && kqop->pid == getpid())
close(kqop->kq);
diff --git a/lib/libevent/poll.c b/lib/libevent/poll.c
index 34884b930d7..ee01c95a5f9 100644
--- a/lib/libevent/poll.c
+++ b/lib/libevent/poll.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: poll.c,v 1.21 2014/10/30 16:45:37 bluhm Exp $ */
+/* $OpenBSD: poll.c,v 1.22 2016/09/03 11:31:17 nayden Exp $ */
/*
* Copyright 2000-2003 Niels Provos <provos@citi.umich.edu>
@@ -359,14 +359,10 @@ poll_dealloc(struct event_base *base, void *arg)
struct pollop *pop = arg;
evsignal_dealloc(base);
- if (pop->event_set)
- free(pop->event_set);
- if (pop->event_r_back)
- free(pop->event_r_back);
- if (pop->event_w_back)
- free(pop->event_w_back);
- if (pop->idxplus1_by_fd)
- free(pop->idxplus1_by_fd);
+ free(pop->event_set);
+ free(pop->event_r_back);
+ free(pop->event_w_back);
+ free(pop->idxplus1_by_fd);
memset(pop, 0, sizeof(struct pollop));
free(pop);
diff --git a/lib/libevent/select.c b/lib/libevent/select.c
index ee95085f35b..fb38b850155 100644
--- a/lib/libevent/select.c
+++ b/lib/libevent/select.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: select.c,v 1.24 2014/10/30 13:43:28 bluhm Exp $ */
+/* $OpenBSD: select.c,v 1.25 2016/09/03 11:31:17 nayden Exp $ */
/*
* Copyright 2000-2002 Niels Provos <provos@citi.umich.edu>
@@ -326,18 +326,12 @@ select_dealloc(struct event_base *base, void *arg)
struct selectop *sop = arg;
evsignal_dealloc(base);
- 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);
+ free(sop->event_readset_in);
+ free(sop->event_writeset_in);
+ free(sop->event_readset_out);
+ free(sop->event_writeset_out);
+ free(sop->event_r_by_fd);
+ free(sop->event_w_by_fd);
memset(sop, 0, sizeof(struct selectop));
free(sop);