代码拉取完成,页面将自动刷新
From 855326a8c9ec1a599354f743fb5391a2766a2a9c Mon Sep 17 00:00:00 2001
From: Jim Fehlig <[email protected]>
Date: Mon, 6 Jan 2020 17:47:10 -0700
Subject: [PATCH 06/19] libmetrics: Ensure libmetrics mutex is unlocked in
error paths
From coverity scan
vhostmd-1.1/libmetrics/libmetrics.c:595: missing_unlock: Returning without unlocking "libmetrics_mutex".
593| if (mdisk_alloc() == NULL) {
594| errno = ENOMEM;
595|-> return -1;
596| }
597| read_mdisk(mdisk);
Signed-off-by: Jim Fehlig <[email protected]>
---
libmetrics/libmetrics.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c
index 2819f80..756645c 100644
--- a/libmetrics/libmetrics.c
+++ b/libmetrics/libmetrics.c
@@ -601,7 +601,7 @@ int get_metric(const char *metric_name, metric **mdef, metric_context context)
mdisk_free();
if (mdisk_alloc() == NULL) {
errno = ENOMEM;
- return -1;
+ goto out;
}
read_mdisk(mdisk);
}
@@ -620,7 +620,7 @@ int get_metric(const char *metric_name, metric **mdef, metric_context context)
if ((lmdef = metric_alloc_padded(extra_len)) == NULL) {
errno = ENOMEM;
- return -1;
+ goto out;
}
lmdef->type = pmdef.type;
@@ -635,6 +635,7 @@ int get_metric(const char *metric_name, metric **mdef, metric_context context)
if (pmdef.context)
free(pmdef.context);
+out:
/* unlock library data */
pthread_mutex_unlock(&libmetrics_mutex);
return ret;
--
2.32.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。