3 Star 0 Fork 0

src-oepkgs/vhostmd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0006-libmetrics-Ensure-libmetrics-mutex-is-unlocked-in-er.patch 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
张一诺 提交于 2022-12-23 17:33 . 1.1
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-oepkgs/vhostmd.git
[email protected]:src-oepkgs/vhostmd.git
src-oepkgs
vhostmd
vhostmd
master

搜索帮助