From: Florian Forster Date: Mon, 19 Feb 2024 22:30:49 +0000 (+0100) Subject: write_prometheus plugin: Fix a deadlock due to a leaked mutex. X-Git-Tag: collectd-6.0.0.rc3~6^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F4285%2Fhead;p=thirdparty%2Fcollectd.git write_prometheus plugin: Fix a deadlock due to a leaked mutex. --- diff --git a/src/write_prometheus.c b/src/write_prometheus.c index 893d680a7..edeef4d46 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];