From 6ac6c9e9ad5a3090afcf0d59eb65e1bd678bab62 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Tue, 14 Feb 2012 12:30:55 +0100 Subject: [PATCH] Fix memory hierarchy when processing nested group memberships https://fedorahosted.org/sssd/ticket/1186 --- src/providers/ldap/sdap_async_initgroups.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/providers/ldap/sdap_async_initgroups.c b/src/providers/ldap/sdap_async_initgroups.c index 964f5b0a0f36951a7bf863b8e1f565e3e77407cf..36291a562b55e616043668c60e7e1cd9eb1f46c5 100644 --- a/src/providers/ldap/sdap_async_initgroups.c +++ b/src/providers/ldap/sdap_async_initgroups.c @@ -2204,10 +2204,13 @@ static void rfc2307bis_nested_groups_process(struct tevent_req *subreq) } /* Copy the new groups into the list. - * They're already allocated on 'state'. + * They're allocated on 'state' so we need to move them + * onto ldap_parents so that the data won't disappear when + * we finish this nesting level. */ for (i = 0; i < count; i++) { - state->ldap_parents[state->parents_count + i] = ldap_groups[i]; + state->ldap_parents[state->parents_count + i] = + talloc_steal(state->ldap_parents, ldap_groups[i]); } state->parents_count += count; -- 1.7.7.6