提交 b66a2110 编写于 作者: W WangFengTu 提交者: lifeng68

fix memory leak

Signed-off-by: NWangFengTu <wangfengtu@huawei.com>
上级 e8159715
......@@ -234,6 +234,9 @@ int oci_split_image_name(const char *image_name, char **host, char **name, char
}
}
free(tmp_image_name);
tmp_image_name = NULL;
return 0;
}
......
......@@ -436,8 +436,12 @@ static int set_cached_info_to_desc(thread_fetch_info *infos, size_t infos_len, p
return -1;
}
desc->layers[i].diff_id = util_strdup_s(cache->diffid);
desc->layers[i].file = util_strdup_s(infos[i].file);
if (desc->layers[i].diff_id == NULL) {
desc->layers[i].diff_id = util_strdup_s(cache->diffid);
}
if (desc->layers[i].file == NULL) {
desc->layers[i].file = util_strdup_s(infos[i].file);
}
}
}
......@@ -1639,6 +1643,7 @@ out:
}
}
free_pull_desc(desc);
desc = NULL;
return ret;
}
......@@ -1780,6 +1785,8 @@ void free_registry_pull_options(registry_pull_options *options)
free_registry_auth(&options->auth);
free(options->image_name);
options->image_name = NULL;
free(options->dest_image_name);
options->dest_image_name = NULL;
free(options);
return;
}
......@@ -1908,5 +1915,8 @@ void free_pull_desc(pull_descriptor *desc)
free(desc->layers);
desc->layers = NULL;
desc->layers_len = 0;
free(desc);
return;
}
......@@ -117,7 +117,8 @@ static int parse_challenges(pull_descriptor *desc, char *schema, char *params)
// schema == NULL means this challenge have not be used.
if (desc->challenges[i].schema == NULL) {
desc->challenges[i] = c;
return 0;
ret = 0;
goto out;
}
}
......@@ -133,7 +134,7 @@ out:
util_free_array(kv);
kv = NULL;
return -1;
return ret;
}
static int parse_auth(pull_descriptor *desc, char *auth)
......
......@@ -368,6 +368,9 @@ out:
fclose((FILE*)stream);
}
free(buffer);
buffer = NULL;
if (ret == 0) {
return util_strdup_s(output_buffer);
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册