From f2bba721d18842a014ab170c207af8e8ecb6e890 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Fri, 19 Jun 2015 10:52:10 +0200 Subject: IFP: Fix warnings with enabled optimisation It seems that gcc 5.1 optimize enum in some ways and expects that unctions ifp_cache_build_path and ifp_cache_build_base_dn can return unitialized value due to missing default in switch. src/responder/ifp/ifp_cache.c:118:13: warning: 'base_dn' may be used uninitialized in this function [-Wmaybe-uninitialized] ldb_ret = ldb_search(sysdb_ctx_get_ldb(domain->sysdb), tmp_ctx, &result, ^ src/responder/ifp/ifp_cache.c: scope_hint: In function 'ifp_cache_get_cached_objects' src/responder/ifp/ifp_cache.c:135:18: warning: 'path' may be used uninitialized in this function [-Wmaybe-uninitialized] paths[i] = ifp_cache_build_path(paths, type, domain, result->msgs[i]); ^ Reviewed-by: Jakub Hrozek --- src/responder/ifp/ifp_cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/responder/ifp/ifp_cache.c b/src/responder/ifp/ifp_cache.c index 9bf7ed7e7..a109ac05d 100644 --- a/src/responder/ifp/ifp_cache.c +++ b/src/responder/ifp/ifp_cache.c @@ -34,7 +34,7 @@ ifp_cache_build_base_dn(TALLOC_CTX *mem_ctx, enum ifp_cache_type type, struct sss_domain_info *domain) { - struct ldb_dn *base_dn; + struct ldb_dn *base_dn = NULL; switch (type) { case IFP_CACHE_USER: @@ -54,7 +54,7 @@ ifp_cache_build_path(TALLOC_CTX *mem_ctx, struct sss_domain_info *domain, struct ldb_message *msg) { - char *path; + char *path = NULL; switch (type) { case IFP_CACHE_USER: -- cgit