summaryrefslogtreecommitdiff
path: root/usr.bin/sndiod/dev.c
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2020-04-15 14:22:30 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2020-04-15 14:22:30 +0000
commitdd10093abec808e5d6a20be4194a27aac6030d2d (patch)
treed552e9b94572a6c265fcee58a5472715f34a4f6a /usr.bin/sndiod/dev.c
parent5a2fca3d54be7cb6641798c3ab15f6dd9fb40f2c (diff)
Don't forget to notify clients when a control is removed
Diffstat (limited to 'usr.bin/sndiod/dev.c')
-rw-r--r--usr.bin/sndiod/dev.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/sndiod/dev.c b/usr.bin/sndiod/dev.c
index 9e8c661ee22..0f97a3ddcfb 100644
--- a/usr.bin/sndiod/dev.c
+++ b/usr.bin/sndiod/dev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.c,v 1.67 2020/04/15 14:21:35 ratchov Exp $ */
+/* $OpenBSD: dev.c,v 1.68 2020/04/15 14:22:29 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
@@ -2330,10 +2330,12 @@ dev_rmctl(struct dev *d, int addr)
}
#endif
c->refs_mask &= ~CTL_DEVMASK;
- if (c->refs_mask != 0)
+ if (c->refs_mask == 0) {
+ *pc = c->next;
+ xfree(c);
return;
- *pc = c->next;
- xfree(c);
+ }
+ c->desc_mask = ~0;
}
void