From 73eff54f86848c2b6f2206244620d42fbadfab09 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 19 Feb 2024 23:30:49 +0100 Subject: [PATCH] write_prometheus plugin: Fix a deadlock due to a leaked mutex. --- src/write_prometheus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/write_prometheus.c b/src/write_prometheus.c index 893d680a70..edeef4d46d 100644 --- a/src/write_prometheus.c +++ b/src/write_prometheus.c @@ -824,8 +824,10 @@ static int prom_missing(metric_family_t const *fam, pthread_mutex_lock(&prom_metrics_lock); metric_family_t *prom_fam = NULL; - if (c_avl_get(prom_metrics, fam->name, (void *)&prom_fam) != 0) + if (c_avl_get(prom_metrics, fam->name, (void *)&prom_fam) != 0) { + pthread_mutex_unlock(&prom_metrics_lock); return 0; + } for (size_t i = 0; i < fam->metric.num; i++) { metric_t const *m = &fam->metric.ptr[i];