Merge pull request #346 from robertbaldyga/fix-memory-alloc-in-metadata
Fix memory allocation in metadata
This commit is contained in:
commit
49d8f10953
10
env/posix/ocf_env.h
vendored
10
env/posix/ocf_env.h
vendored
@ -124,6 +124,16 @@ static inline void env_free(const void *ptr)
|
||||
free((void *)ptr);
|
||||
}
|
||||
|
||||
static inline void *env_vmalloc_flags(size_t size, int flags)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
static inline void *env_vzalloc_flags(size_t size, int flags)
|
||||
{
|
||||
return env_zalloc(size, 0);
|
||||
}
|
||||
|
||||
static inline void *env_vmalloc(size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
|
@ -375,7 +375,7 @@ static int metadata_io_i_asynch(ocf_cache_t cache, ocf_queue_t queue, int dir,
|
||||
if (count == 0)
|
||||
return 0;
|
||||
|
||||
a_req = env_vzalloc(sizeof(*a_req));
|
||||
a_req = env_vzalloc_flags(sizeof(*a_req), ENV_MEM_NOIO);
|
||||
if (!a_req)
|
||||
return -OCF_ERR_NO_MEM;
|
||||
|
||||
@ -422,7 +422,7 @@ static int metadata_io_i_asynch(ocf_cache_t cache, ocf_queue_t queue, int dir,
|
||||
compl_hndl(cache, context, a_req->error);
|
||||
|
||||
if (env_atomic_dec_return(&a_req->req_active) == 0)
|
||||
env_free(a_req);
|
||||
env_vfree(a_req);
|
||||
|
||||
return 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user