From 759fd29a597533a3f5489246c0d2b658d8bee417 Mon Sep 17 00:00:00 2001 From: Pavel Reichl Date: Thu, 26 Jun 2014 18:22:40 +0100 Subject: LDAP: group_split_members returns incorrectly ENOMEM Don't fail if num_missing is 0. Resolves: https://fedorahosted.org/sssd/ticket/2369 Reviewed-by: Jakub Hrozek --- src/providers/ldap/sdap_async_nested_groups.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/providers/ldap/sdap_async_nested_groups.c b/src/providers/ldap/sdap_async_nested_groups.c index b17946fc3..bc3250248 100644 --- a/src/providers/ldap/sdap_async_nested_groups.c +++ b/src/providers/ldap/sdap_async_nested_groups.c @@ -589,7 +589,10 @@ sdap_nested_group_split_members(TALLOC_CTX *mem_ctx, missing = talloc_realloc(mem_ctx, missing, struct sdap_nested_group_member, num_missing); - if (missing == NULL) { + /* talloc_realloc behaves as talloc_free if 3rd parameter (count) is 0, + * so it's OK to return NULL then + */ + if (missing == NULL && num_missing > 0) { ret = ENOMEM; goto done; } -- cgit