!58 iSulad: fix some memory bugs
From: @jingwoo Reviewed-by: @duguhaotian Signed-off-by: @duguhaotian
This commit is contained in:
commit
c8a4392549
53
0011-iSulad-fix-memory-leak.patch
Normal file
53
0011-iSulad-fix-memory-leak.patch
Normal file
@ -0,0 +1,53 @@
|
||||
From 32c7b484da4e5546d28bc5d88866fa018a0df647 Mon Sep 17 00:00:00 2001
|
||||
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
Date: Tue, 22 Sep 2020 15:29:00 +0800
|
||||
Subject: [PATCH 1/2] iSulad: fix memory leak
|
||||
|
||||
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
---
|
||||
src/daemon/modules/image/oci/storage/storage.c | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/daemon/modules/image/oci/storage/storage.c b/src/daemon/modules/image/oci/storage/storage.c
|
||||
index 8ad96d60..249aa1b3 100644
|
||||
--- a/src/daemon/modules/image/oci/storage/storage.c
|
||||
+++ b/src/daemon/modules/image/oci/storage/storage.c
|
||||
@@ -103,15 +103,14 @@ static int fill_read_wrapper(const char *layer_data_path, struct io_read_wrapper
|
||||
reader_tmp = util_common_calloc_s(sizeof(struct io_read_wrapper));
|
||||
if (reader_tmp == NULL) {
|
||||
ERROR("Memory out");
|
||||
- ret = -1;
|
||||
- goto out;
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
fd_ptr = util_common_calloc_s(sizeof(int));
|
||||
if (fd_ptr == NULL) {
|
||||
ERROR("Memory out");
|
||||
ret = -1;
|
||||
- goto out;
|
||||
+ goto err_out;
|
||||
}
|
||||
|
||||
*fd_ptr = util_open(layer_data_path, O_RDONLY, 0);
|
||||
@@ -125,13 +124,14 @@ static int fill_read_wrapper(const char *layer_data_path, struct io_read_wrapper
|
||||
reader_tmp->read = layer_archive_io_read;
|
||||
reader_tmp->close = layer_archive_io_close;
|
||||
*reader = reader_tmp;
|
||||
-
|
||||
- goto out;
|
||||
+
|
||||
+ fd_ptr = NULL;
|
||||
+ reader_tmp = NULL;
|
||||
|
||||
err_out:
|
||||
free(fd_ptr);
|
||||
free(reader_tmp);
|
||||
-out:
|
||||
+
|
||||
return ret;
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
32
0012-fix-coredump-when-load-image-with-uid.patch
Normal file
32
0012-fix-coredump-when-load-image-with-uid.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From 514f43054196785e2d40b51592e6691616938f69 Mon Sep 17 00:00:00 2001
|
||||
From: wujing <wujing50@huawei.com>
|
||||
Date: Tue, 22 Sep 2020 16:22:01 +0800
|
||||
Subject: [PATCH 2/2] fix coredump when load image with uid
|
||||
|
||||
Signed-off-by: wujing <wujing50@huawei.com>
|
||||
---
|
||||
.../modules/image/oci/storage/image_store/image_store.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/src/daemon/modules/image/oci/storage/image_store/image_store.c b/src/daemon/modules/image/oci/storage/image_store/image_store.c
|
||||
index 2d2136ed..f6dd1ef1 100644
|
||||
--- a/src/daemon/modules/image/oci/storage/image_store/image_store.c
|
||||
+++ b/src/daemon/modules/image/oci/storage/image_store/image_store.c
|
||||
@@ -3119,6 +3119,14 @@ static int pack_user_info_from_image(const docker_image_config_v2 *config_v2, im
|
||||
goto out;
|
||||
}
|
||||
if (util_safe_llong(user, &converted) == 0) {
|
||||
+ if (info->uid == NULL) {
|
||||
+ info->uid = (imagetool_image_uid *)util_common_calloc_s(sizeof(imagetool_image_uid));
|
||||
+ if (info->uid == NULL) {
|
||||
+ ERROR("Out of memory");
|
||||
+ ret = -1;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
info->uid->value = (int64_t)converted;
|
||||
} else {
|
||||
info->username = util_strdup_s(user);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
10
iSulad.spec
10
iSulad.spec
@ -1,5 +1,5 @@
|
||||
%global _version 2.0.5
|
||||
%global _release 20200918.112827.git9aea9b75
|
||||
%global _release 20200923.094914.git05e545f7
|
||||
%global is_systemd 1
|
||||
|
||||
Name: iSulad
|
||||
@ -23,6 +23,8 @@ Patch6007: 0007-image-clear-memory-if-failed.patch
|
||||
Patch6008: 0008-fix-layer-remain-caused-by-hold-flag-not-clean.patch
|
||||
Patch6009: 0009-fix-coredump-when-pull-image-with-lock-driver-image-.patch
|
||||
Patch6010: 0010-fix-bad-formatting-placeholder-in-http-parse-module.patch
|
||||
Patch6011: 0011-iSulad-fix-memory-leak.patch
|
||||
Patch6012: 0012-fix-coredump-when-load-image-with-uid.patch
|
||||
|
||||
%ifarch x86_64 aarch64
|
||||
Provides: libhttpclient.so()(64bit)
|
||||
@ -230,6 +232,12 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
+* Fri Sep 23 2020 <wujing50@huawei.com> - 2.0.5-20200923.094914.git05e545f7
|
||||
+- Type:bugfix
|
||||
+- ID:NA
|
||||
+- SUG:NA
|
||||
+- DESC: fix some memory bugs
|
||||
|
||||
+* Fri Sep 18 2020 <lifeng68@huawei.com> - 2.0.5-20200918.112827.git9aea9b75
|
||||
+- Type:bugfix
|
||||
+- ID:NA
|
||||
|
||||
@ -24,7 +24,7 @@ first_old_version=$(cat ${specfile} | grep "%global" | grep "_version" | awk {'
|
||||
second_old_version=$(cat ${specfile} | grep "%global" | grep "_version" | awk {'print $3'} | awk -F "." {'print $2'})
|
||||
third_old_version=$(cat ${specfile} | grep "%global" | grep "_version" | awk {'print $3'} | awk -F "." {'print $3'})
|
||||
read -p "Which level version do you want to upgrade?[1/2/3/d/N](default:N) select:" choice
|
||||
if [[ ! -n "${choice}" || ${choice} == "N" ]]; then
|
||||
if [[ ! -n "${choice}" ]] || [[ ${choice} == "N" ]]; then
|
||||
echo "The version number has not been modified, it is still ${old_version}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user