fix valgrind found errors

This commit is contained in:
xianjimli 2019-01-17 14:05:15 +08:00
parent 96c943ffb5
commit 1fe6a5fd0b
3 changed files with 3 additions and 11 deletions

View File

@ -223,6 +223,7 @@ asset_info_t* assets_manager_load(assets_manager_t* rm, asset_type_t type, const
if (info != NULL) {
assets_manager_add(rm, info);
asset_info_unref(info);
}
return info;
@ -380,18 +381,8 @@ ret_t assets_manager_clear_cache(assets_manager_t* rm, asset_type_t type) {
}
ret_t assets_manager_deinit(assets_manager_t* rm) {
uint32_t i = 0;
asset_info_t* iter = NULL;
asset_info_t** all = NULL;
return_value_if_fail(rm != NULL, RET_BAD_PARAMS);
all = (asset_info_t**)(rm->assets.elms);
for (i = 0; i < rm->assets.size; i++) {
iter = all[i];
asset_info_destroy(iter);
}
TKMEM_FREE(rm->res_root);
darray_deinit(&(rm->assets));

View File

@ -47,7 +47,7 @@ static ret_t object_destroy(object_t* obj) {
obj->vt = NULL;
obj->ref_count = 0;
emitter_deinit((emitter_t*)obj);
TKMEM_FREE(obj->name);
TKMEM_FREE(obj);
return ret;

View File

@ -306,6 +306,7 @@ TEST(WStr, push_int) {
ASSERT_EQ(wstr_to_int(s, &v), RET_OK);
ASSERT_EQ(v, 12345);
s->size = 0;
wstr_reset(&str);
wstr_init(&str1, 0);
wstr_set(&str1, L"0123");