Merge pull request #1008 from mmichal10/cas-mem-leak
casadm: fix memory leak
This commit is contained in:
commit
da0e4452b7
@ -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