efreetd: If we fail to allocate space for subdir_cache, then get out

Summary: Fix coverity CID1294212 (potential Null pointer dereference) as
the alloc for subdir_cache Could fail, however if it does we Were
still trying to use it. In the case that it fails, ERR msg and return.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-04-13 20:29:53 -04:00
parent ae8afa2748
commit 4b950b55c0
1 changed files with 6 additions and 1 deletions

View File

@ -131,7 +131,12 @@ subdir_cache_init(void)
}
// if we don't have a decoded subdir cache - allocate one
if (!subdir_cache) subdir_cache = calloc(1, sizeof(Subdir_Cache));
if (!subdir_cache) ERR("Cannot allocate subdir cache in memory");
if (!subdir_cache)
{
ERR("Cannot allocate subdir cache in memory");
return;
}
// if we don't have a hash in the subdir cache - allocate it
if (!subdir_cache->dirs)
subdir_cache->dirs = eina_hash_string_superfast_new(EINA_FREE_CB(subdir_cache_dir_free));