summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2017-11-20 17:26:39 +0000
committerratchov <ratchov@openbsd.org>2017-11-20 17:26:39 +0000
commitc699f4b95948bf9e4b0ecfdfca78b05bd9dd8afb (patch)
treea4c611c2d3519451800255288c85d2f6a03ca1e0
parentSkip the test and print a warning if pf does not process packets (diff)
downloadwireguard-openbsd-c699f4b95948bf9e4b0ecfdfca78b05bd9dd8afb.tar.xz
wireguard-openbsd-c699f4b95948bf9e4b0ecfdfca78b05bd9dd8afb.zip
Free memory in the error code-path, when we run out of descriptors
during initialization. From Michael W. Bombardieri, thanks.
-rw-r--r--usr.bin/sndiod/fdpass.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/sndiod/fdpass.c b/usr.bin/sndiod/fdpass.c
index 4e1970dd20b..a74aacfdcaa 100644
--- a/usr.bin/sndiod/fdpass.c
+++ b/usr.bin/sndiod/fdpass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdpass.c,v 1.3 2016/01/08 16:17:31 ratchov Exp $ */
+/* $OpenBSD: fdpass.c,v 1.4 2017/11/20 17:26:39 ratchov Exp $ */
/*
* Copyright (c) 2015 Alexandre Ratchov <alex@caoua.org>
*
@@ -357,6 +357,7 @@ fdpass_new(int sock, struct fileops *ops)
f->file = file_new(ops, f, ops->name, 1);
if (f->file == NULL) {
close(sock);
+ xfree(f);
return NULL;
}
f->fd = sock;