diff options
author | Rich Megginson <rmeggins@redhat.com> | 2009-05-19 14:45:58 -0600 |
---|---|---|
committer | Rich Megginson <rmeggins@redhat.com> | 2009-05-19 15:47:02 -0600 |
commit | f2ad3fd08e6a4a0d9c0c36ff0328456c4f615d66 (patch) | |
tree | 72fd2d7203283733640a7895a59b5c970dce68f0 | |
parent | f9db3ac14855eb07e49f2f5797cbb7d338bb614b (diff) | |
download | ds-f2ad3fd08e6a4a0d9c0c36ff0328456c4f615d66.tar.gz ds-f2ad3fd08e6a4a0d9c0c36ff0328456c4f615d66.tar.xz ds-f2ad3fd08e6a4a0d9c0c36ff0328456c4f615d66.zip |
Resolves: bug 501490 - Error creating view on FDS 1.2
Reviewed by: nhosoi (Thanks!)
The problem is when the views code calls views_cache_discover_children()
and there are no children. The code should check to see if the child_count
is 0, and only attempt to alloc space for the pChildren array if the
child_count is greater than 0.
Platforms tested: RHEL5 x86_64
-rw-r--r-- | ldap/servers/plugins/views/views.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/ldap/servers/plugins/views/views.c b/ldap/servers/plugins/views/views.c index cc310077..80e52b9e 100644 --- a/ldap/servers/plugins/views/views.c +++ b/ldap/servers/plugins/views/views.c @@ -703,16 +703,19 @@ static void views_cache_discover_children(viewEntry *pView) /* make the space for them */ pView->child_count = child_count; - - pView->pChildren = (void **)slapi_ch_calloc(child_count, sizeof(viewEntry*)); - /* add them */ - for(current = head; current != NULL; current = current->list.pNext) + if (child_count > 0) { - if(slapi_dn_isparent(pView->pDn, current->pDn)) + pView->pChildren = (void **)slapi_ch_calloc(child_count, sizeof(viewEntry*)); + + /* add them */ + for(current = head; current != NULL; current = current->list.pNext) { - ((viewEntry**)pView->pChildren)[add_count] = current; - add_count++; + if(slapi_dn_isparent(pView->pDn, current->pDn)) + { + ((viewEntry**)pView->pChildren)[add_count] = current; + add_count++; + } } } } |