Sync the features and bug fixed in the etmem source repository. Signed-off-by: liubo <liubo254@huawei.com> (cherry picked from commit 07dd6a411bce9ed3d9f617a6f01ae076e24a3adf)
52 lines
1.9 KiB
Diff
52 lines
1.9 KiB
Diff
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
|
|
|