Fix leak in core pool
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
b9fce50783
commit
7352f3092d
@ -204,7 +204,7 @@ int ocf_dobj_create(ocf_data_obj_t *obj, ocf_data_obj_type_t type,
|
||||
*
|
||||
* @param[in] obj data object handle
|
||||
*/
|
||||
void ocf_data_obj_destroy(ocf_data_obj_t obj);
|
||||
void ocf_dobj_destroy(ocf_data_obj_t obj);
|
||||
|
||||
/**
|
||||
* @brief Get data object type
|
||||
|
@ -778,21 +778,16 @@ int ocf_mngt_core_pool_visit(ocf_ctx_t ctx,
|
||||
int (*visitor)(ocf_uuid_t, void *), void *visitor_ctx);
|
||||
|
||||
/**
|
||||
* @brief Remove core from pool
|
||||
* @brief Remove data object from pool
|
||||
*
|
||||
* Important: This function destroys data object instance but doesn't close it,
|
||||
* so it should be either moved or closed before calling this function.
|
||||
*
|
||||
* @param[in] ctx OCF context
|
||||
* @param[in] obj Core data object
|
||||
*/
|
||||
void ocf_mngt_core_pool_remove(ocf_ctx_t ctx, ocf_data_obj_t obj);
|
||||
|
||||
/**
|
||||
* @brief Close and remove core from pool
|
||||
*
|
||||
* @param[in] ctx OCF context
|
||||
* @param[in] obj Core data object
|
||||
*/
|
||||
void ocf_mngt_core_pool_close_and_remove(ocf_ctx_t ctx, ocf_data_obj_t obj);
|
||||
|
||||
/**
|
||||
* @brief Deinit core pool
|
||||
*
|
||||
|
@ -99,15 +99,7 @@ void ocf_mngt_core_pool_remove(ocf_ctx_t ctx, ocf_data_obj_t obj)
|
||||
ctx->core_pool.core_pool_count--;
|
||||
list_del(&obj->core_pool_item);
|
||||
env_mutex_unlock(&ctx->lock);
|
||||
ocf_dobj_deinit(obj);
|
||||
}
|
||||
|
||||
void ocf_mngt_core_pool_close_and_remove(ocf_ctx_t ctx, ocf_data_obj_t obj)
|
||||
{
|
||||
OCF_CHECK_NULL(ctx);
|
||||
OCF_CHECK_NULL(obj);
|
||||
ocf_dobj_close(obj);
|
||||
ocf_mngt_core_pool_remove(ctx, obj);
|
||||
ocf_dobj_destroy(obj);
|
||||
}
|
||||
|
||||
void ocf_mngt_core_pool_deinit(ocf_ctx_t ctx)
|
||||
@ -118,6 +110,7 @@ void ocf_mngt_core_pool_deinit(ocf_ctx_t ctx)
|
||||
|
||||
list_for_each_entry_safe(sobj, tobj, &ctx->core_pool.core_pool_head,
|
||||
core_pool_item) {
|
||||
ocf_mngt_core_pool_close_and_remove(ctx, sobj);
|
||||
ocf_dobj_close(sobj);
|
||||
ocf_mngt_core_pool_remove(ctx, sobj);
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ int ocf_dobj_create(ocf_data_obj_t *obj, ocf_data_obj_type_t type,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ocf_data_obj_destroy(ocf_data_obj_t obj)
|
||||
void ocf_dobj_destroy(ocf_data_obj_t obj)
|
||||
{
|
||||
OCF_CHECK_NULL(obj);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user