casadm: fix memory leak
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
parent
772193c00e
commit
3d8d5c2e99
@ -774,6 +774,9 @@ struct cache_device *get_cache_device(const struct kcas_cache_info *info, bool b
|
||||
cache_size = sizeof(*cache);
|
||||
cache_size += info->info.core_count * sizeof(cache->cores[0]);
|
||||
|
||||
if (info->info.failover_detached)
|
||||
return NULL;
|
||||
|
||||
cache = (struct cache_device *) malloc(cache_size);
|
||||
if (NULL == cache) {
|
||||
return NULL;
|
||||
@ -784,9 +787,6 @@ struct cache_device *get_cache_device(const struct kcas_cache_info *info, bool b
|
||||
cache->id = cache_id;
|
||||
cache->state = info->info.state;
|
||||
|
||||
if (info->info.failover_detached)
|
||||
return NULL;
|
||||
|
||||
if (strncpy_s(cache->device, sizeof(cache->device),
|
||||
info->cache_path_name,
|
||||
sizeof(info->cache_path_name))) {
|
||||
|
Loading…
Reference in New Issue
Block a user