diff options
author | Pavel Březina <pbrezina@redhat.com> | 2013-06-17 14:47:36 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-06-18 09:09:18 +0200 |
commit | e6dee5182d07e3fdbcdfe5b1b3d36f1d26672223 (patch) | |
tree | 3ffcc65c1422bc534cdd6d9004e144d5034125af /src/providers/ldap/sdap_async_nested_groups.c | |
parent | 1b224723e8db9699835ad58d6f589328f928e14e (diff) | |
download | sssd-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.
Diffstat (limited to 'src/providers/ldap/sdap_async_nested_groups.c')
-rw-r--r-- | src/providers/ldap/sdap_async_nested_groups.c | 16 |
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; |