sndiod: Fix use-after-free causing crash when devices is disconnected

This commit is contained in:
Alexandre Ratchov 2021-03-03 10:31:20 +01:00
parent e5766cbfc0
commit a6a6dcb57c
1 changed files with 4 additions and 4 deletions

View File

@ -1290,12 +1290,12 @@ dev_abort(struct dev *d)
d->slot_list = NULL;
for (c = ctlslot_array, i = DEV_NCTLSLOT; i > 0; i--, c++) {
if (c->ops == NULL)
continue;
if (c->opt->dev != d)
continue;
if (c->ops) {
c->ops->exit(c->arg);
c->ops = NULL;
}
c->ops->exit(c->arg);
c->ops = NULL;
}
midi_abort(d->midi);