[SSSD] [PATCH] sss_names_init: Report correct error code if allocation failed

Jakub Hrozek jhrozek at redhat.com
Wed Jun 13 13:19:38 UTC 2012


I found this when checking my DIR: cache patches with clang.
-------------- next part --------------
>From 2808d0cbec4787c77335cc3f4359acb4bd04e6d8 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Wed, 13 Jun 2012 15:08:05 +0200
Subject: [PATCH] sss_names_init: Report correct error code if allocation
 failed

---
 src/util/usertools.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/util/usertools.c b/src/util/usertools.c
index 7675585eacc5fa7c9645be8def64d40b080a041c..a3d210e36645c331e180729b734264462f30e05a 100644
--- a/src/util/usertools.c
+++ b/src/util/usertools.c
@@ -70,7 +70,10 @@ int sss_names_init(TALLOC_CTX *mem_ctx, struct confdb_ctx *cdb,
     talloc_set_destructor(ctx, sss_names_ctx_destructor);
 
     tmpctx = talloc_new(NULL);
-    if (tmpctx == NULL) goto done;
+    if (tmpctx == NULL) {
+        ret = ENOMEM;
+        goto done;
+    }
 
     conf_path = talloc_asprintf(tmpctx, CONFDB_DOMAIN_PATH_TMPL, domain);
     if (conf_path == NULL) {
-- 
1.7.10.2



More information about the sssd-devel mailing list