diff options
author | CoprDistGit <infra@openeuler.org> | 2025-01-11 14:20:43 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2025-01-11 14:20:43 +0000 |
commit | 2295e96f69a8c13751ba69ea9176b0599c0909a8 (patch) | |
tree | c908aaed1b7f92c2e5aaa55ac6981ebe00dfe9bf /0173-bugfix-mem-leak.patch | |
parent | b7a2cf915b9d2c7e530c02097631b69bacc0e93c (diff) |
automatic import of iSuladopeneuler24.03_LTS
Diffstat (limited to '0173-bugfix-mem-leak.patch')
-rw-r--r-- | 0173-bugfix-mem-leak.patch | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/0173-bugfix-mem-leak.patch b/0173-bugfix-mem-leak.patch new file mode 100644 index 0000000..a477201 --- /dev/null +++ b/0173-bugfix-mem-leak.patch @@ -0,0 +1,64 @@ +From 3144357f7c735e24af180b9352378618ce8b2368 Mon Sep 17 00:00:00 2001 +From: liuxu <liuxu156@huawei.com> +Date: Wed, 11 Dec 2024 11:32:06 +0800 +Subject: [PATCH 07/11] bugfix: mem leak + +Signed-off-by: liuxu <liuxu156@huawei.com> +--- + src/daemon/executor/container_cb/execution_network.c | 2 ++ + src/daemon/modules/service/inspect_container.c | 2 ++ + src/utils/cutils/utils.c | 9 ++++++++- + 3 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/src/daemon/executor/container_cb/execution_network.c b/src/daemon/executor/container_cb/execution_network.c +index a145e33a..8e34998c 100644 +--- a/src/daemon/executor/container_cb/execution_network.c ++++ b/src/daemon/executor/container_cb/execution_network.c +@@ -1213,6 +1213,8 @@ static int generate_network_element(const char **bridges, const size_t len, defs + defs_map_string_object_networks_element *), len); + if (networks->values == NULL) { + ERROR("Out of memory "); ++ free(networks->keys); ++ networks->keys = NULL; + return -1; + } + +diff --git a/src/daemon/modules/service/inspect_container.c b/src/daemon/modules/service/inspect_container.c +index 40cf7aa1..ca3955c6 100644 +--- a/src/daemon/modules/service/inspect_container.c ++++ b/src/daemon/modules/service/inspect_container.c +@@ -629,6 +629,8 @@ static int do_transform_cni_to_map(container_network_settings *settings) + util_smart_calloc_s(sizeof(defs_map_string_object_port_bindings_element *), settings->cni_ports_len); + if (result->values == NULL) { + ERROR("Out of memory"); ++ free(result->keys); ++ result->keys = NULL; + ret = -1; + goto out; + } +diff --git a/src/utils/cutils/utils.c b/src/utils/cutils/utils.c +index 69f6dbf0..cf207acc 100644 +--- a/src/utils/cutils/utils.c ++++ b/src/utils/cutils/utils.c +@@ -1609,10 +1609,17 @@ defs_map_string_object *dup_map_string_empty_object(defs_map_string_object *src) + } + + dst->keys = util_smart_calloc_s(sizeof(char *), src->len); ++ if (dst->keys == NULL) { ++ ERROR("Out of memory"); ++ ret = -1; ++ goto out; ++ } + dst->values = util_smart_calloc_s(sizeof(defs_map_string_object_element *), src->len); +- if (dst->keys == NULL || dst->values == NULL) { ++ if (dst->values == NULL) { + ERROR("Out of memory"); + ret = -1; ++ free(dst->keys); ++ dst->keys = NULL; + goto out; + } + +-- +2.23.0 + |