Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
0083-etmem-fix-memory-leak.patch 1.95 KB
Copy Edit Raw Blame History
刘波 authored 2022-08-01 10:57 . etmem: sync source repo submission
From 4bca2f765de38ce263cf5c7507c717b04395b012 Mon Sep 17 00:00:00 2001
From: liubo <liubo254@huawei.com>
Date: Mon, 13 Jun 2022 15:59:05 +0800
Subject: [PATCH 33/33] etmem: fix memory leak
In the configuration file parsing process, if the parameter
value is not configured, the val memory should be released.
When the project is deleted, the memory of the pid list
corresponding to the task needs to be released.
Signed-off-by: liubo <liubo254@huawei.com>
---
etmem/src/etmemd_src/etmemd_file.c | 8 +++++++-
etmem/src/etmemd_src/etmemd_slide.c | 1 +
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/etmem/src/etmemd_src/etmemd_file.c b/etmem/src/etmemd_src/etmemd_file.c
index b7dc27f..d204685 100644
--- a/etmem/src/etmemd_src/etmemd_file.c
+++ b/etmem/src/etmemd_src/etmemd_file.c
@@ -35,7 +35,13 @@ static int parse_item(GKeyFile *config, char *group_name, struct config_item *it
break;
case STR_VAL:
val = (void *)g_key_file_get_string(config, group_name, item->key, &error);
- if (val == NULL || strlen(val) == 0) {
+ if (val == NULL) {
+ etmemd_log(ETMEMD_LOG_ERR, "section %s of group [%s] should not be empty\n", item->key, group_name);
+ return -1;
+ }
+
+ if (strlen(val) == 0) {
+ free(val);
etmemd_log(ETMEMD_LOG_ERR, "section %s of group [%s] should not be empty\n", item->key, group_name);
return -1;
}
diff --git a/etmem/src/etmemd_src/etmemd_slide.c b/etmem/src/etmemd_src/etmemd_slide.c
index 236778a..a3c474b 100644
--- a/etmem/src/etmemd_src/etmemd_slide.c
+++ b/etmem/src/etmemd_src/etmemd_slide.c
@@ -388,6 +388,7 @@ static void slide_stop_task(struct engine *eng, struct task *tk)
struct slide_params *params = tk->params;
stop_and_delete_threadpool_work(tk);
+ etmemd_free_task_pids(tk);
free(params->executor);
params->executor = NULL;
}
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化