Fix crash caused by confusion between requested device and last used one
authorratchov <ratchov@openbsd.org>
Tue, 15 Mar 2022 05:53:37 +0000 (05:53 +0000)
committerratchov <ratchov@openbsd.org>
Tue, 15 Mar 2022 05:53:37 +0000 (05:53 +0000)
Found by and ok semarie@

usr.bin/sndiod/dev.c

index b63af22..b9f244b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: dev.c,v 1.103 2021/11/01 14:43:24 ratchov Exp $       */
+/*     $OpenBSD: dev.c,v 1.104 2022/03/15 05:53:37 ratchov Exp $       */
 /*
  * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
  *
@@ -1776,7 +1776,7 @@ slot_new(struct opt *opt, unsigned int id, char *who,
 
 found:
        /* open device, this may change opt's device */
-       if (!opt_ref(s->opt))
+       if (!opt_ref(opt))
                return NULL;
        s->opt = opt;
        s->ops = ops;