Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
423902b4
I
iSulad
项目概览
openeuler
/
iSulad
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
iSulad
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
423902b4
编写于
5月 09, 2020
作者:
W
wujing
提交者:
lifeng68
7月 25, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix image store memory leak
Signed-off-by:
N
wujing
<
wujing50@huawei.com
>
上级
3500a89a
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
28 addition
and
9 deletion
+28
-9
src/image/oci/storage/image_store/image_store.c
src/image/oci/storage/image_store/image_store.c
+28
-9
未找到文件。
src/image/oci/storage/image_store/image_store.c
浏览文件 @
423902b4
...
...
@@ -122,6 +122,7 @@ static void free_image_store(image_store_t *store)
linked_list_del
(
item
);
image_ref_dec
((
image_t
*
)
item
->
elem
);
free
(
item
);
item
=
NULL
;
}
store
->
images_list_len
=
0
;
...
...
@@ -311,6 +312,7 @@ static int remove_name(image_t *img, const char *name)
free
(
img
->
simage
->
names
);
img
->
simage
->
names
=
tmp_names
;
img
->
simage
->
names_len
=
index
;
tmp_names
=
NULL
;
return
0
;
}
...
...
@@ -908,6 +910,8 @@ out:
if
(
ret
!=
0
)
{
free
(
dst_id
);
dst_id
=
NULL
;
free_storage_image
(
im
);
im
=
NULL
;
free_image_t
(
img
);
img
=
NULL
;
}
...
...
@@ -1143,6 +1147,7 @@ static int remove_image_from_memory(const char *id)
linked_list_del
(
item
);
image_ref_dec
(
tmp
);
free
(
item
);
item
=
NULL
;
g_image_store
->
images_list_len
--
;
break
;
}
...
...
@@ -1294,8 +1299,9 @@ int image_store_wipe()
}
out:
image_store_unlock
();
free
(
tmp_id
);
map_itor_free
(
itor
);
image_store_unlock
();
return
ret
;
}
...
...
@@ -1361,10 +1367,15 @@ static int get_data_path(const char *id, const char *key, char *path, size_t len
char
data_dir
[
PATH_MAX
]
=
{
0x00
};
data_base_name
=
make_big_data_base_name
(
key
);
if
(
data_base_name
==
NULL
)
{
ERROR
(
"Failed to make big data base name"
);
return
-
1
;
}
if
(
get_data_dir
(
id
,
data_dir
,
sizeof
(
data_dir
))
!=
0
)
{
ERROR
(
"Failed to get image data dir: %s"
,
id
);
return
-
1
;
ret
=
-
1
;
goto
out
;
}
nret
=
snprintf
(
path
,
len
,
"%s/%s"
,
data_dir
,
data_base_name
);
...
...
@@ -1866,9 +1877,10 @@ out:
int
image_store_set_load_time
(
const
char
*
id
,
const
types_timestamp_t
*
time
)
{
#define MAX_TIMESTAMP_LEN 128
int
ret
=
0
;
image_t
*
img
=
NULL
;
char
timebuffer
[
512
]
=
{
0x00
};
char
timebuffer
[
MAX_TIMESTAMP_LEN
]
=
{
0x00
};
if
(
id
==
NULL
||
time
==
NULL
)
{
ERROR
(
"Invalid input paratemers"
);
...
...
@@ -1876,7 +1888,7 @@ int image_store_set_load_time(const char *id, const types_timestamp_t *time)
}
if
(
g_image_store
==
NULL
)
{
ERROR
(
"
i
mage store is not ready"
);
ERROR
(
"
I
mage store is not ready"
);
return
-
1
;
}
...
...
@@ -2070,10 +2082,14 @@ static char *get_digest_with_update_big_data(const char *id, const char *key)
}
if
(
image_store_set_big_data
(
id
,
key
,
data
)
!=
0
)
{
free
(
data
);
ERROR
(
"Failed to set big data"
);
return
NULL
;
}
free
(
data
);
data
=
NULL
;
img
=
lookup_with_lock
(
id
);
if
(
img
==
NULL
)
{
ERROR
(
"Image not known"
);
...
...
@@ -2083,7 +2099,7 @@ static char *get_digest_with_update_big_data(const char *id, const char *key)
image_lock
(
img
);
value
=
get_value_from_json_map_string_string
(
img
->
simage
->
big_data_digests
,
key
);
digest
=
(
value
!=
NULL
?
util_strdup_s
(
value
)
:
NULL
);
digest
=
util_strdup_s
(
value
);
image_unlock
(
img
);
image_ref_dec
(
img
);
...
...
@@ -2116,7 +2132,7 @@ char *image_store_big_data_digest(const char *id, const char *key)
image_lock
(
img
);
value
=
get_value_from_json_map_string_string
(
img
->
simage
->
big_data_digests
,
key
);
digest
=
(
value
!=
NULL
?
util_strdup_s
(
value
)
:
NULL
);
digest
=
util_strdup_s
(
value
);
image_unlock
(
img
);
image_ref_dec
(
img
);
...
...
@@ -2192,7 +2208,7 @@ char *image_store_metadata(const char *id)
}
image_lock
(
img
);
metadata
=
(
img
->
simage
->
metadata
!=
NULL
?
util_strdup_s
(
img
->
simage
->
metadata
)
:
NULL
);
metadata
=
util_strdup_s
(
img
->
simage
->
metadata
);
image_unlock
(
img
);
image_ref_dec
(
img
);
...
...
@@ -2221,7 +2237,7 @@ char *image_store_top_layer(const char *id)
}
image_lock
(
img
);
top_layer
=
(
img
->
simage
->
layer
!=
NULL
?
util_strdup_s
(
img
->
simage
->
layer
)
:
NULL
);
top_layer
=
util_strdup_s
(
img
->
simage
->
layer
);
image_unlock
(
img
);
image_ref_dec
(
img
);
...
...
@@ -2311,6 +2327,7 @@ out:
util_free_array
(
*
image_tags
);
free
(
*
first_name
);
}
free
(
prefix
);
return
ret
;
}
...
...
@@ -2482,6 +2499,7 @@ static int get_image_repo_digests(char ***old_repo_digests, char **image_tags, i
}
out:
free
(
img_digest
);
free
(
digest
);
map_free
(
digest_map
);
return
ret
;
...
...
@@ -2519,6 +2537,7 @@ out:
free
(
image_digest
);
util_free_array
(
tags
);
util_free_array
(
digests
);
util_free_array
(
repo_digests
);
return
ret
;
}
...
...
@@ -2867,7 +2886,7 @@ int image_store_get_images_by_digest(const char *digest, imagetool_images_list *
}
if
(
digest_imgs
->
images_list_len
==
0
)
{
ERROR
(
"No images found related to the digest"
);
DEBUG
(
"No images found related to the digest: %s"
,
digest
);
goto
out
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录