[SSSD] [PATCH] LDAP: Return correct error code

Lukas Slebodnik lslebodn at redhat.com
Wed Oct 30 14:13:15 UTC 2013


On (30/10/13 15:12), Lukas Slebodnik wrote:
>ehlo,
>
>I found one warning, while I was testing some patches.
>This warning was unrelated to patches, therefore I am sending
>separate email.
>
>simple patch is attached.
>
>LS

and now really with attachment.

LS
-------------- next part --------------
>From 7530065e503509e24ac62d8311f641e0605ec87e Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 30 Oct 2013 14:55:13 +0100
Subject: [PATCH] LDAP: Return correct error code

If talloc_array return NULL we should return right error code from function
sdap_domain_subdom_add. It might happen that we could return either wrong error
code or uninitialized variable ret.
---
 src/providers/ldap/ldap_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c
index fcb8c4884a2f31916b4fbf46e295d951942adfdc..7192740b6e901063509ccff7e83c0920f80d950d 100644
--- a/src/providers/ldap/ldap_common.c
+++ b/src/providers/ldap/ldap_common.c
@@ -134,7 +134,7 @@ sdap_domain_subdom_add(struct sdap_id_ctx *sdap_id_ctx,
         talloc_zfree(sdom->search_bases);
         sdom->search_bases = talloc_array(sdom, struct sdap_search_base *, 2);
         if (sdom->search_bases == NULL) {
-            return ret;
+            return ENOMEM;
         }
         sdom->search_bases[1] = NULL;
 
-- 
1.8.3.1



More information about the sssd-devel mailing list