From 4b950b55c08d220d9b26d4a5a479d11ca4ea3e9b Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Mon, 13 Apr 2015 20:29:53 -0400 Subject: [PATCH] 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 --- src/bin/efreet/efreetd_cache.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bin/efreet/efreetd_cache.c b/src/bin/efreet/efreetd_cache.c index 8c6bab62a3..12f16cbe6f 100644 --- a/src/bin/efreet/efreetd_cache.c +++ b/src/bin/efreet/efreetd_cache.c @@ -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));