summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2017-11-20 17:26:40 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2017-11-20 17:26:40 +0000
commita4fbbb12c39bbed14e0048edff53aadea9ce71e1 (patch)
tree356c7eddef1852af8a8224f4a98d285e8c2163bf /usr.bin
parent736a8447c59cff39b41c88ff937c1af4430c95e9 (diff)
Free memory in the error code-path, when we run out of descriptors
during initialization. From Michael W. Bombardieri, thanks.
Diffstat (limited to 'usr.bin')
-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;