From: Andre Noll Date: Mon, 5 Apr 2021 18:29:28 +0000 (+0200) Subject: prebuffer: Remove buffer tree node on errors. X-Git-Tag: v0.6.4~28 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=8c13bf36f418e8476c268d376e79491fcb48a0f2 prebuffer: Remove buffer tree node on errors. When the ->post_select method of a filter returns negative, it *must* remove its buffer tree node as well. The prebuffer missed to do that, which results in a stale reference to the buffer tree which keeps the audiod slot busy. When no more slots are free, audiod hangs or exits with a "no more free slots" message. This patch avoids this. --- diff --git a/prebuffer_filter.c b/prebuffer_filter.c index 1988e6e0..9a801900 100644 --- a/prebuffer_filter.c +++ b/prebuffer_filter.c @@ -61,10 +61,10 @@ static int prebuffer_post_select(__a_unused struct sched *s, void *context) ret = task_get_notification(fn->task); if (ret < 0) - return ret; + goto fail; ret = btr_node_status(btrn, size, BTR_NT_INTERNAL); if (ret < 0) - return ret; + goto fail; if (ppd->barrier.tv_sec == 0) return 0; if (tv_diff(now, &ppd->barrier, NULL) < 0) @@ -73,6 +73,9 @@ static int prebuffer_post_select(__a_unused struct sched *s, void *context) return 0; btr_splice_out_node(&fn->btrn); return -E_PREBUFFER_SUCCESS; +fail: + btr_remove_node(&fn->btrn); + return ret; } static void prebuffer_open(struct filter_node *fn)