!482 bugfix for cleanup module memory leak

From: @driedyellowpeach 
Reviewed-by: @duguhaotian 
Signed-off-by: @duguhaotian
This commit is contained in:
openeuler-ci-bot 2022-11-03 01:21:44 +00:00 committed by Gitee
commit cc25367556
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
44 changed files with 435 additions and 42 deletions

View File

@ -1,7 +1,7 @@
From f9cb1b86511fac1c3a7f11fdaa4c9c20dc889068 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Sun, 9 Oct 2022 19:00:38 +0800
Subject: [PATCH 01/39] use epoll instead of select for wait_exit_fifo
Subject: [PATCH 01/43] use epoll instead of select for wait_exit_fifo
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---

View File

@ -1,7 +1,7 @@
From 864a500f18d56aebeaa71960f10791386212b18b Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Thu, 13 Oct 2022 15:55:08 +0800
Subject: [PATCH 02/39] add namespace util UT
Subject: [PATCH 02/43] add namespace util UT
Signed-off-by: haozi007 <liuhao27@huawei.com>
---

View File

@ -1,7 +1,7 @@
From d1061efc9a83df659f5aeab57352b9247380217a Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Thu, 13 Oct 2022 16:56:10 +0800
Subject: [PATCH 03/39] refactor build system of cutils ut
Subject: [PATCH 03/43] refactor build system of cutils ut
Signed-off-by: haozi007 <liuhao27@huawei.com>
---

View File

@ -1,7 +1,7 @@
From 8c33633d26ec5d5eb9b5ad415afc114cf6c232f3 Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Tue, 11 Oct 2022 20:34:18 +0800
Subject: [PATCH 04/39] run storage layers ut with non-root
Subject: [PATCH 04/43] run storage layers ut with non-root
Signed-off-by: haozi007 <liuhao27@huawei.com>
---

View File

@ -1,7 +1,7 @@
From 0ddc58b78b0ca7d6c1cb52b10e3fa03f0da69326 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Sat, 15 Oct 2022 16:51:38 +0800
Subject: [PATCH 05/39] add extern C for mainloop header
Subject: [PATCH 05/43] add extern C for mainloop header
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---

View File

@ -1,7 +1,7 @@
From f7089859d339cfe2b33ab701c02e1f424e4bd248 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Sat, 15 Oct 2022 16:52:32 +0800
Subject: [PATCH 06/39] add UT for mainloop and network
Subject: [PATCH 06/43] add UT for mainloop and network
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---

View File

@ -1,7 +1,7 @@
From 59b3f0832626fecebef66326b5316dbd10e482e0 Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Sat, 15 Oct 2022 14:53:50 +0800
Subject: [PATCH 07/39] add check for aes apis
Subject: [PATCH 07/43] add check for aes apis
Signed-off-by: haozi007 <liuhao27@huawei.com>
---

View File

@ -1,7 +1,7 @@
From 3909ddbc369c69202308e77beda6553b7d95d79b Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Sat, 15 Oct 2022 15:04:56 +0800
Subject: [PATCH 08/39] add ut for cutils aes
Subject: [PATCH 08/43] add ut for cutils aes
Signed-off-by: haozi007 <liuhao27@huawei.com>
---

View File

@ -1,7 +1,7 @@
From b2f293d1777ba3846ea4bcab5754b66ebfe4094c Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Sat, 15 Oct 2022 17:01:02 +0800
Subject: [PATCH 09/39] add ut for cutils error
Subject: [PATCH 09/43] add ut for cutils error
Signed-off-by: haozi007 <liuhao27@huawei.com>
---

View File

@ -1,7 +1,7 @@
From 99caa82b9406ef344707401c0b8c548296924466 Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Sat, 15 Oct 2022 17:18:28 +0800
Subject: [PATCH 10/39] ensure argument is not null
Subject: [PATCH 10/43] ensure argument is not null
Signed-off-by: haozi007 <liuhao27@huawei.com>
---

View File

@ -1,7 +1,7 @@
From 8020e1e076e597a82962fe03990f89314f5419fa Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Mon, 17 Oct 2022 11:10:05 +0800
Subject: [PATCH 11/39] add ut for utils_fs
Subject: [PATCH 11/43] add ut for utils_fs
Signed-off-by: haozi007 <liuhao27@huawei.com>
---

View File

@ -1,7 +1,7 @@
From f1313b04f60672a1aae1a3d36df5f0b8abcdd06f Mon Sep 17 00:00:00 2001
From: zhongtao <taozh97@163.com>
Date: Mon, 17 Oct 2022 15:04:01 +0800
Subject: [PATCH 12/39] Add adaptation code for filters
Subject: [PATCH 12/43] Add adaptation code for filters
Signed-off-by: zhongtao <taozh97@163.com>
---

View File

@ -1,7 +1,7 @@
From 45824723bf3968a1106089fb0572ad6a593ac62e Mon Sep 17 00:00:00 2001
From: zhongtao <taozh97@163.com>
Date: Mon, 17 Oct 2022 15:15:49 +0800
Subject: [PATCH 13/39] Add parameter check to path
Subject: [PATCH 13/43] Add parameter check to path
Signed-off-by: zhongtao <taozh97@163.com>
---

View File

@ -1,7 +1,7 @@
From 8cd75df646c836745b5a1325e68be67046a84f1a Mon Sep 17 00:00:00 2001
From: zhongtao <taozh97@163.com>
Date: Mon, 17 Oct 2022 18:23:19 +0800
Subject: [PATCH 14/39] Add ut for utils_convert
Subject: [PATCH 14/43] Add ut for utils_convert
Signed-off-by: zhongtao <taozh97@163.com>
---

View File

@ -1,7 +1,7 @@
From eb122520ccdcd71dee4e93d3bf9e6c296e3af315 Mon Sep 17 00:00:00 2001
From: zhongtao <taozh97@163.com>
Date: Mon, 17 Oct 2022 11:43:18 +0800
Subject: [PATCH 15/39] Add ut for path
Subject: [PATCH 15/43] Add ut for path
Signed-off-by: zhongtao <taozh97@163.com>
---

View File

@ -1,7 +1,7 @@
From e8b1afc8241200a51b1eab8884fca4bfda286126 Mon Sep 17 00:00:00 2001
From: zhongtao <taozh97@163.com>
Date: Mon, 17 Oct 2022 11:25:58 +0800
Subject: [PATCH 16/39] Add ut for filters
Subject: [PATCH 16/43] Add ut for filters
Signed-off-by: zhongtao <taozh97@163.com>
---

View File

@ -1,7 +1,7 @@
From 5b7c5fd4d856ad222dc51d79f8cf972730e48a54 Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Mon, 17 Oct 2022 14:31:39 +0800
Subject: [PATCH 17/39] add static for unexport function
Subject: [PATCH 17/43] add static for unexport function
1. add static for inner function;
2. add check for aguments;

View File

@ -1,7 +1,7 @@
From 725f5813ee3125ad3c55dfbe3aeb5d8155e93e8f Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Mon, 17 Oct 2022 20:16:58 +0800
Subject: [PATCH 18/39] add ut for cutils timestamp
Subject: [PATCH 18/43] add ut for cutils timestamp
Signed-off-by: haozi007 <liuhao27@huawei.com>
---

View File

@ -1,7 +1,7 @@
From e437396ff5bc90bfa3736e0ef06be117bca4b174 Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Tue, 18 Oct 2022 10:23:34 +0800
Subject: [PATCH 19/39] fix timestamp ut error
Subject: [PATCH 19/43] fix timestamp ut error
Signed-off-by: haozi007 <liuhao27@huawei.com>
---

View File

@ -1,7 +1,7 @@
From 99df201139e1afbc719f78bae047eaf826676b7f Mon Sep 17 00:00:00 2001
From: zhongtao <taozh97@163.com>
Date: Mon, 17 Oct 2022 20:20:00 +0800
Subject: [PATCH 20/39] improve code in utils_mount_spec
Subject: [PATCH 20/43] improve code in utils_mount_spec
Signed-off-by: zhongtao <taozh97@163.com>
---

View File

@ -1,7 +1,7 @@
From 7e4921d01576f180c3624195a0edff4b4f6807f8 Mon Sep 17 00:00:00 2001
From: zhongtao <taozh97@163.com>
Date: Tue, 18 Oct 2022 10:46:14 +0800
Subject: [PATCH 21/39] Add ut for utils_mount_spec
Subject: [PATCH 21/43] Add ut for utils_mount_spec
Signed-off-by: zhongtao <taozh97@163.com>
---

View File

@ -1,7 +1,7 @@
From e43af2dc017a63a772c7dea2583d7d58506d7608 Mon Sep 17 00:00:00 2001
From: zhongtao <taozh97@163.com>
Date: Tue, 18 Oct 2022 11:50:37 +0800
Subject: [PATCH 22/39] Add ut for utils_regex
Subject: [PATCH 22/43] Add ut for utils_regex
Signed-off-by: zhongtao <taozh97@163.com>
---

View File

@ -1,7 +1,7 @@
From 60ef94806076e728b6f76d5b9b874e375182233c Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Tue, 18 Oct 2022 15:47:36 +0800
Subject: [PATCH 23/39] improve code in utils.c
Subject: [PATCH 23/43] improve code in utils.c
Signed-off-by: haozi007 <liuhao27@huawei.com>
---

View File

@ -1,7 +1,7 @@
From fef883b9716bf8b71dd10152d9dea1b4e6952530 Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Tue, 18 Oct 2022 17:11:04 +0800
Subject: [PATCH 24/39] add ut for cutils utils
Subject: [PATCH 24/43] add ut for cutils utils
Signed-off-by: haozi007 <liuhao27@huawei.com>
---

View File

@ -1,7 +1,7 @@
From 979b21ba298edc64c88e2534b013076aa92ec975 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Wed, 19 Oct 2022 14:38:49 +0800
Subject: [PATCH 25/39] make sure kill pid not negative
Subject: [PATCH 25/43] make sure kill pid not negative
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---

View File

@ -1,7 +1,7 @@
From d9eb77bbe430fa74ca1c55c0c6907afaeb559499 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Tue, 18 Oct 2022 19:19:23 +0800
Subject: [PATCH 26/39] add UT for atomic and map
Subject: [PATCH 26/43] add UT for atomic and map
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---

View File

@ -1,7 +1,7 @@
From d9f2f58a5c8952fe0f03c8f6fbbed7f741a41e68 Mon Sep 17 00:00:00 2001
From: zhongtao <taozh97@163.com>
Date: Wed, 19 Oct 2022 15:12:27 +0800
Subject: [PATCH 27/39] remove unnecessary goto and add parameter check for
Subject: [PATCH 27/43] remove unnecessary goto and add parameter check for
verify
Signed-off-by: zhongtao <taozh97@163.com>

View File

@ -1,7 +1,7 @@
From c31c29a9ea4f4818036ee52cb85f82b5a02e43f9 Mon Sep 17 00:00:00 2001
From: zhongtao <taozh97@163.com>
Date: Wed, 19 Oct 2022 15:09:34 +0800
Subject: [PATCH 28/39] Add ut for verify
Subject: [PATCH 28/43] Add ut for verify
Signed-off-by: zhongtao <taozh97@163.com>
---

View File

@ -1,7 +1,7 @@
From f342d18d5eb26baabad2749002bac71b412ed8b6 Mon Sep 17 00:00:00 2001
From: zhongtao <taozh97@163.com>
Date: Thu, 20 Oct 2022 19:03:57 +0800
Subject: [PATCH 29/39] fix error in utils_verify_ut
Subject: [PATCH 29/43] fix error in utils_verify_ut
Signed-off-by: zhongtao <taozh97@163.com>
---

View File

@ -1,7 +1,7 @@
From 5e4fc62e36631d8d2e444ac3d60ce99ec7396ca0 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Fri, 21 Oct 2022 09:58:40 +0800
Subject: [PATCH 30/39] add more test for string and map
Subject: [PATCH 30/43] add more test for string and map
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---

View File

@ -1,7 +1,7 @@
From 81cf4edd6aa0c4170eb0ec48a6934ef3262a920d Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Sat, 22 Oct 2022 11:48:48 +0800
Subject: [PATCH 31/39] remove mnt point if add device mapper device failed
Subject: [PATCH 31/43] remove mnt point if add device mapper device failed
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---

View File

@ -1,7 +1,7 @@
From 5ded258d2e9a331a1fa5e3f76757fdb1e868cc8f Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Thu, 20 Oct 2022 16:17:26 +0800
Subject: [PATCH 32/39] dec device info ref in grow device fs
Subject: [PATCH 32/43] dec device info ref in grow device fs
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---

View File

@ -1,7 +1,7 @@
From 4b59b86a191a43d88423a1f2659392b8bd9ff849 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Wed, 26 Oct 2022 16:57:41 +0800
Subject: [PATCH 33/39] device mapper bugfix
Subject: [PATCH 33/43] device mapper bugfix
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---

View File

@ -1,7 +1,7 @@
From 1111a16537bddf5d272f58bd1b67969f105a426d Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Fri, 28 Oct 2022 11:21:19 +0800
Subject: [PATCH 34/39] delete syncCloseSem when close all wssession
Subject: [PATCH 34/43] delete syncCloseSem when close all wssession
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---

View File

@ -1,7 +1,7 @@
From b0022ff6d820d17428aa04e6be148e84dade0855 Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Fri, 28 Oct 2022 16:32:03 +0800
Subject: [PATCH 35/39] [improve] debug information for console io
Subject: [PATCH 35/43] [improve] debug information for console io
Signed-off-by: haozi007 <liuhao27@huawei.com>
---

View File

@ -1,7 +1,7 @@
From afe09041af292ae529ba8071e0737be778223853 Mon Sep 17 00:00:00 2001
From: songbuhuang <544824346@qq.com>
Date: Sat, 29 Oct 2022 16:35:21 +0800
Subject: [PATCH 36/39] add ut for file
Subject: [PATCH 36/43] add ut for file
Signed-off-by: songbuhuang <544824346@qq.com>
---

View File

@ -1,7 +1,7 @@
From d7b324c04b4b353270216887b05e245337942b97 Mon Sep 17 00:00:00 2001
From: zhongtao <taozh97@163.com>
Date: Mon, 24 Oct 2022 20:46:47 +0800
Subject: [PATCH 37/39] Add extend C for header files
Subject: [PATCH 37/43] Add extend C for header files
Signed-off-by: zhongtao <taozh97@163.com>
---

View File

@ -0,0 +1,119 @@
From a27582c9e626d01c47ff29d4b2480813a69fa3a6 Mon Sep 17 00:00:00 2001
From: songbuhuang <544824346@qq.com>
Date: Tue, 18 Oct 2022 17:19:00 +0800
Subject: [PATCH 38/43] add isula create --rm option
Signed-off-by: songbuhuang <544824346@qq.com>
---
src/cmd/isula/base/create.c | 14 ++++++++++++++
src/cmd/isula/base/create.h | 7 +++++++
src/cmd/isula/base/run.c | 17 +++--------------
src/cmd/isula/base/run.h | 9 +--------
4 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/src/cmd/isula/base/create.c b/src/cmd/isula/base/create.c
index 97da80ac..8cef5d17 100644
--- a/src/cmd/isula/base/create.c
+++ b/src/cmd/isula/base/create.c
@@ -2149,6 +2149,15 @@ out:
return ret;
}
+static int create_check_auto_remove(const struct client_arguments *args)
+{
+ if (args->custom_conf.auto_remove && ((args->restart != NULL) && (strcmp("no", args->restart) != 0))) {
+ COMMAND_ERROR("Conflicting options: --restart and --rm");
+ return -1;
+ }
+ return 0;
+}
+
int create_checker(struct client_arguments *args)
{
int ret = 0;
@@ -2236,6 +2245,11 @@ int create_checker(struct client_arguments *args)
goto out;
}
+ if (create_check_auto_remove(args)) {
+ ret = -1;
+ goto out;
+ }
+
out:
return ret;
}
diff --git a/src/cmd/isula/base/create.h b/src/cmd/isula/base/create.h
index 467fefe8..4f63d92f 100644
--- a/src/cmd/isula/base/create.h
+++ b/src/cmd/isula/base/create.h
@@ -306,6 +306,13 @@ extern "C" {
&(cmdargs).restart, \
"Restart policy to apply when a container exits(no, always, on-reboot, on-failure[:max-retries])", \
NULL }, \
+ { CMD_OPT_TYPE_BOOL, \
+ false, \
+ "rm", \
+ 0, \
+ &(cmdargs).custom_conf.auto_remove, \
+ "Automatically remove the container when it exits", \
+ NULL }, \
{ CMD_OPT_TYPE_STRING, \
false, \
"host-channel", \
diff --git a/src/cmd/isula/base/run.c b/src/cmd/isula/base/run.c
index 53e89c3d..73486c95 100644
--- a/src/cmd/isula/base/run.c
+++ b/src/cmd/isula/base/run.c
@@ -195,11 +195,8 @@ free_out:
static int run_checker(struct client_arguments *args)
{
- int ret = 0;
-
- ret = create_checker(args);
- if (ret) {
- goto out;
+ if (create_checker(args)) {
+ return -1;
}
/* Make detach option a high priority than terminal */
@@ -208,13 +205,5 @@ static int run_checker(struct client_arguments *args)
args->custom_conf.attach_stdout = false;
args->custom_conf.attach_stderr = false;
}
-
- if (args->custom_conf.auto_remove && ((args->restart != NULL) && (strcmp("no", args->restart) != 0))) {
- COMMAND_ERROR("Conflicting options: --restart and --rm");
- ret = -1;
- goto out;
- }
-
-out:
- return ret;
+ return 0;
}
diff --git a/src/cmd/isula/base/run.h b/src/cmd/isula/base/run.h
index 2658c33d..efca28a9 100644
--- a/src/cmd/isula/base/run.h
+++ b/src/cmd/isula/base/run.h
@@ -34,14 +34,7 @@ extern "C" {
'd', \
&(cmdargs).detach, \
"Run container in background and print container ID", \
- NULL }, \
- { CMD_OPT_TYPE_BOOL, \
- false, \
- "rm", \
- 0, \
- &(cmdargs).custom_conf.auto_remove, \
- "Automatically remove the container when it exits", \
- NULL },
+ NULL },
extern const char g_cmd_run_desc[];
extern const char g_cmd_run_usage[];
--
2.25.1

View File

@ -1,7 +1,7 @@
From 587aa25d7f44f79c28c3331b81bbc77efb7e1eb1 Mon Sep 17 00:00:00 2001
From: "Neil.wrz" <wangrunze13@huawei.com>
Date: Thu, 27 Oct 2022 00:45:53 -0700
Subject: [PATCH 38/39] feat add container cleanup module
Subject: [PATCH 39/43] feat add container cleanup module
Signed-off-by: Neil.wrz <wangrunze13@huawei.com>
---

View File

@ -1,7 +1,7 @@
From 3942fb5667077200017a1a7c72672e482e798df6 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Tue, 1 Nov 2022 14:36:02 +0800
Subject: [PATCH 39/39] bugfix for websocket receive data too long
Subject: [PATCH 40/43] bugfix for websocket receive data too long
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---

View File

@ -0,0 +1,38 @@
From 53372ea2cf848e0352bdd4fba4a664b4955cdd6e Mon Sep 17 00:00:00 2001
From: "Neil.wrz" <wangrunze13@huawei.com>
Date: Tue, 1 Nov 2022 18:50:48 -0700
Subject: [PATCH 41/43] fix call bim_put in im_get_rootfs_dir
Signed-off-by: Neil.wrz <wangrunze13@huawei.com>
---
src/daemon/modules/image/image.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/daemon/modules/image/image.c b/src/daemon/modules/image/image.c
index 3c395c1f..ed7d968a 100644
--- a/src/daemon/modules/image/image.c
+++ b/src/daemon/modules/image/image.c
@@ -1774,6 +1774,8 @@ int im_container_export(const im_export_request *request)
#ifdef ENABLE_OCI_IMAGE
char *im_get_rootfs_dir(const im_get_rf_dir_request *request) {
+ char *dir = NULL;
+
if (request->type == NULL) {
ERROR("Missing image type");
return NULL;
@@ -1785,8 +1787,10 @@ char *im_get_rootfs_dir(const im_get_rf_dir_request *request) {
ERROR("Unimplemnts get rootfs dir in %s", bim->type);
return NULL;
}
+ dir = bim->ops->get_dir_rf();
+ bim_put(bim);
- return bim->ops->get_dir_rf();
+ return dir;
}
#else
char *im_get_rootfs_dir(const im_get_rf_dir_request *request) {
--
2.25.1

View File

@ -0,0 +1,152 @@
From c47dc7d4a038dd9b2e2ec3bb27938e03502724d9 Mon Sep 17 00:00:00 2001
From: songbuhuang <544824346@qq.com>
Date: Tue, 18 Oct 2022 21:25:02 +0800
Subject: [PATCH 42/43] isula usage consistency optimization
Signed-off-by: songbuhuang <544824346@qq.com>
---
src/cmd/isula/extend/events.c | 2 +-
src/cmd/isula/extend/export.c | 2 +-
src/cmd/isula/images/images.c | 2 +-
src/cmd/isula/images/logout.c | 2 +-
src/cmd/isula/images/pull.c | 2 +-
src/cmd/isula/information/inspect.c | 2 +-
src/cmd/isula/information/ps.c | 2 +-
src/cmd/isula/information/version.c | 2 +-
src/cmd/isula/stream/cp.c | 2 +-
9 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/cmd/isula/extend/events.c b/src/cmd/isula/extend/events.c
index 7094ac0d..b35f246a 100644
--- a/src/cmd/isula/extend/events.c
+++ b/src/cmd/isula/extend/events.c
@@ -27,7 +27,7 @@
#include "utils_timestamp.h"
const char g_cmd_events_desc[] = "Get real time events from the server";
-const char g_cmd_events_usage[] = "events [command options]";
+const char g_cmd_events_usage[] = "events [OPTIONS]";
struct client_arguments g_cmd_events_args = {
.since = NULL,
diff --git a/src/cmd/isula/extend/export.c b/src/cmd/isula/extend/export.c
index ea9b9c11..68d17c82 100644
--- a/src/cmd/isula/extend/export.c
+++ b/src/cmd/isula/extend/export.c
@@ -28,7 +28,7 @@
#include "connect.h"
const char g_cmd_export_desc[] = "export container";
-const char g_cmd_export_usage[] = "export [command options] [ID|NAME]";
+const char g_cmd_export_usage[] = "export [OPTIONS] [ID|NAME]";
struct client_arguments g_cmd_export_args = {};
diff --git a/src/cmd/isula/images/images.c b/src/cmd/isula/images/images.c
index 3d538aa5..e4b28f5a 100644
--- a/src/cmd/isula/images/images.c
+++ b/src/cmd/isula/images/images.c
@@ -44,7 +44,7 @@
#define SHORT_DIGEST_LEN 12
const char g_cmd_images_desc[] = "List images";
-const char g_cmd_images_usage[] = "images";
+const char g_cmd_images_usage[] = "images [OPTIONS]";
struct client_arguments g_cmd_images_args = {};
/* keep track of field widths for printing. */
diff --git a/src/cmd/isula/images/logout.c b/src/cmd/isula/images/logout.c
index a5b99073..18c9b061 100644
--- a/src/cmd/isula/images/logout.c
+++ b/src/cmd/isula/images/logout.c
@@ -64,7 +64,6 @@ int client_logout(const struct client_arguments *args)
ret = ESERVERERROR;
goto out;
}
-
COMMAND_ERROR("Logout Succeeded");
out:
@@ -79,6 +78,7 @@ int cmd_logout_main(int argc, const char **argv)
int exit_code = 1; /* exit 1 if failed to logout */
command_t cmd;
struct command_option options[] = {
+ LOG_OPTIONS(lconf)
COMMON_OPTIONS(g_cmd_logout_args)
};
diff --git a/src/cmd/isula/images/pull.c b/src/cmd/isula/images/pull.c
index fbe7458b..548e8d90 100644
--- a/src/cmd/isula/images/pull.c
+++ b/src/cmd/isula/images/pull.c
@@ -63,7 +63,6 @@ int client_pull(const struct client_arguments *args)
ret = ESERVERERROR;
goto out;
}
-
COMMAND_ERROR("Image \"%s\" pulled", response->image_ref);
out:
@@ -78,6 +77,7 @@ int cmd_pull_main(int argc, const char **argv)
int exit_code = 1; /* exit 1 if failed to pull */
command_t cmd;
struct command_option options[] = {
+ LOG_OPTIONS(lconf)
COMMON_OPTIONS(g_cmd_pull_args)
};
diff --git a/src/cmd/isula/information/inspect.c b/src/cmd/isula/information/inspect.c
index bb52b42a..b86f931f 100644
--- a/src/cmd/isula/information/inspect.c
+++ b/src/cmd/isula/information/inspect.c
@@ -27,7 +27,7 @@
#include "connect.h"
const char g_cmd_inspect_desc[] = "Return low-level information on a container or image";
-const char g_cmd_inspect_usage[] = "inspect [options] CONTAINER|IMAGE [CONTAINER|IMAGE...]";
+const char g_cmd_inspect_usage[] = "inspect [OPTIONS] CONTAINER|IMAGE [CONTAINER|IMAGE...]";
struct client_arguments g_cmd_inspect_args = {
.format = NULL,
diff --git a/src/cmd/isula/information/ps.c b/src/cmd/isula/information/ps.c
index 71c01acb..57d34aa3 100644
--- a/src/cmd/isula/information/ps.c
+++ b/src/cmd/isula/information/ps.c
@@ -32,7 +32,7 @@
#include "utils_timestamp.h"
const char g_cmd_list_desc[] = "List containers";
-const char g_cmd_list_usage[] = "ps [command options]";
+const char g_cmd_list_usage[] = "ps [OPTIONS]";
#define COMMAND_LENGTH_MAX 22
#define TIME_DURATION_MAX_LEN 32
diff --git a/src/cmd/isula/information/version.c b/src/cmd/isula/information/version.c
index 1e94f08a..037a8e1f 100644
--- a/src/cmd/isula/information/version.c
+++ b/src/cmd/isula/information/version.c
@@ -27,7 +27,7 @@
#include "constants.h"
const char g_cmd_version_desc[] = "Display information about isula";
-const char g_cmd_version_usage[] = "version";
+const char g_cmd_version_usage[] = "version [OPTIONS]";
struct client_arguments g_cmd_version_args = {};
diff --git a/src/cmd/isula/stream/cp.c b/src/cmd/isula/stream/cp.c
index 450a7990..f85602ed 100644
--- a/src/cmd/isula/stream/cp.c
+++ b/src/cmd/isula/stream/cp.c
@@ -41,7 +41,7 @@
const char g_cmd_cp_desc[] = "Copy files/folders between a container and the local filesystem";
const char g_cmd_cp_usage[] = "cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH\n"
- " cp [OPTIONS] SRC_PATH CONTAINER:DEST_PATH";
+ " cp [OPTIONS] SRC_PATH CONTAINER:DEST_PATH";
struct client_arguments g_cmd_cp_args = {};
--
2.25.1

View File

@ -0,0 +1,74 @@
From a04bf6abc54f6516d5181fbfa7e08cc1095bc72e Mon Sep 17 00:00:00 2001
From: "Neil.wrz" <wangrunze13@huawei.com>
Date: Wed, 2 Nov 2022 00:01:43 -0700
Subject: [PATCH 43/43] fix do container_unref in oci_rootfs_clean
Signed-off-by: Neil.wrz <wangrunze13@huawei.com>
---
src/daemon/modules/container/leftover_cleanup/cleanup.c | 2 +-
src/daemon/modules/container/leftover_cleanup/cleanup.h | 2 +-
.../modules/container/leftover_cleanup/oci_rootfs_clean.c | 2 ++
.../modules/image/oci/storage/rootfs_store/rootfs_store.c | 2 +-
4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/daemon/modules/container/leftover_cleanup/cleanup.c b/src/daemon/modules/container/leftover_cleanup/cleanup.c
index 29fa4bfa..ec9517cf 100644
--- a/src/daemon/modules/container/leftover_cleanup/cleanup.c
+++ b/src/daemon/modules/container/leftover_cleanup/cleanup.c
@@ -48,7 +48,7 @@ static void destroy_cleaners(struct cleaners *clns)
free(clns);
}
-static int add_clean_node(struct cleaners * clns, clean_func_t f, char * desc)
+static int add_clean_node(struct cleaners *clns, clean_func_t f, const char *desc)
{
struct linked_list *new_node = NULL;
struct clean_node *c_node = NULL;
diff --git a/src/daemon/modules/container/leftover_cleanup/cleanup.h b/src/daemon/modules/container/leftover_cleanup/cleanup.h
index 26fc1b0b..efae99d0 100644
--- a/src/daemon/modules/container/leftover_cleanup/cleanup.h
+++ b/src/daemon/modules/container/leftover_cleanup/cleanup.h
@@ -27,7 +27,7 @@ extern "C" {
typedef int clean_func_t(void);
struct clean_node {
- char *desc;
+ const char *desc;
clean_func_t *cleaner;
int error_code;
};
diff --git a/src/daemon/modules/container/leftover_cleanup/oci_rootfs_clean.c b/src/daemon/modules/container/leftover_cleanup/oci_rootfs_clean.c
index db56870b..fbef4ce0 100644
--- a/src/daemon/modules/container/leftover_cleanup/oci_rootfs_clean.c
+++ b/src/daemon/modules/container/leftover_cleanup/oci_rootfs_clean.c
@@ -31,6 +31,7 @@ static bool walk_dir_cb(const char *path_name, const struct dirent *sub_dir, voi
int rm_rootfs_ret = 0;
if (cont != NULL) {
+ container_unref(cont);
return true;
}
@@ -58,6 +59,7 @@ int oci_rootfs_cleaner(void)
}
ret = util_scan_subdirs(rf_dir, walk_dir_cb, &res);
+ free(rf_dir);
if (ret != 0) {
ERROR("failed to scan subdirs");
return -1;
diff --git a/src/daemon/modules/image/oci/storage/rootfs_store/rootfs_store.c b/src/daemon/modules/image/oci/storage/rootfs_store/rootfs_store.c
index 0270f6a7..97cc39e8 100644
--- a/src/daemon/modules/image/oci/storage/rootfs_store/rootfs_store.c
+++ b/src/daemon/modules/image/oci/storage/rootfs_store/rootfs_store.c
@@ -1322,5 +1322,5 @@ out:
char *rootfs_store_get_data_dir()
{
- return g_rootfs_store->dir;
+ return util_strdup_s(g_rootfs_store->dir);
}
\ No newline at end of file
--
2.25.1

View File

@ -1,5 +1,5 @@
%global _version 2.0.17
%global _release 5
%global _release 6
%global is_systemd 1
%global enable_shimv2 1
%global is_embedded 1
@ -50,8 +50,12 @@ Patch0034: 0034-delete-syncCloseSem-when-close-all-wssession.patch
Patch0035: 0035-improve-debug-information-for-console-io.patch
Patch0036: 0036-add-ut-for-file.patch
Patch0037: 0037-Add-extend-C-for-header-files.patch
Patch0038: 0038-feat-add-container-cleanup-module.patch
Patch0039: 0039-bugfix-for-websocket-receive-data-too-long.patch
Patch0038: 0038-add-isula-create-rm-option.patch
Patch0039: 0039-feat-add-container-cleanup-module.patch
Patch0040: 0040-bugfix-for-websocket-receive-data-too-long.patch
Patch0041: 0041-fix-call-bim_put-in-im_get_rootfs_dir.patch
Patch0042: 0042-isula-usage-consistency-optimization.patch
Patch0043: 0043-fix-do-container_unref-in-oci_rootfs_clean.patch
%ifarch x86_64 aarch64
Provides: libhttpclient.so()(64bit)
@ -278,6 +282,12 @@ fi
%endif
%changelog
* Wed Nov 02 2022 wangrunze <wangrunze13@huawei.com> - 2.0.17-6
- Type: bugfix
- ID: NA
- SUG: NA
- DESC: fix cleanup module memory leak
* Tue Nov 01 2022 zhangxiaoyu <zhangxiaoyu58@huawei.com> - 2.0.17-5
- Type: enhancement
- ID: NA