summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2013-06-17 14:47:36 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-06-18 09:09:18 +0200
commite6dee5182d07e3fdbcdfe5b1b3d36f1d26672223 (patch)
tree3ffcc65c1422bc534cdd6d9004e144d5034125af
parent1b224723e8db9699835ad58d6f589328f928e14e (diff)
downloadsssd-e6dee5182d07e3fdbcdfe5b1b3d36f1d26672223.tar.gz
sssd-e6dee5182d07e3fdbcdfe5b1b3d36f1d26672223.tar.bz2
sssd-e6dee5182d07e3fdbcdfe5b1b3d36f1d26672223.zip
nested groups: do not return ENOMEM if num_groups is 0
talloc_realloc(..., 0) calls talloc_free() and returns NULL. If we process group that contains only users, we errornously return ENOMEM.
-rw-r--r--src/providers/ldap/sdap_async_nested_groups.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/providers/ldap/sdap_async_nested_groups.c b/src/providers/ldap/sdap_async_nested_groups.c
index e2071535..f72b3a3f 100644
--- a/src/providers/ldap/sdap_async_nested_groups.c
+++ b/src/providers/ldap/sdap_async_nested_groups.c
@@ -2168,12 +2168,16 @@ sdap_nested_group_deref_direct_process(struct tevent_req *subreq)
}
/* adjust size of nested groups array */
- state->nested_groups = talloc_realloc(state, state->nested_groups,
- struct sysdb_attrs *,
- state->num_groups);
- if (state->nested_groups == NULL) {
- ret = ENOMEM;
- goto done;
+ if (state->num_groups > 0) {
+ state->nested_groups = talloc_realloc(state, state->nested_groups,
+ struct sysdb_attrs *,
+ state->num_groups);
+ if (state->nested_groups == NULL) {
+ ret = ENOMEM;
+ goto done;
+ }
+ } else {
+ talloc_zfree(state->nested_groups);
}
ret = EOK;