ldap/servers/slapd/entry.c | 6 +++---
ldap/servers/slapd/mapping_tree.c | 2 +-
ldap/servers/slapd/schema.c | 2 +-
ldap/servers/slapd/vattr.c | 8 ++++----
4 files changed, 9 insertions(+), 9 deletions(-)
New commits:
commit 9d5d73c6b617a4caddd36cbe0085995930b928e0
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Thu Mar 17 09:32:01 2011 -0700
Bug 688341 - (cov#10702) Fix Coverity code maintainability issues
We are computing the size of memory needed by using the incorrect
pointer type.
diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c
index 898fe93..c511d1f 100644
--- a/ldap/servers/slapd/mapping_tree.c
+++ b/ldap/servers/slapd/mapping_tree.c
@@ -1535,7 +1535,7 @@ add_internal_mapping_tree_node(const char *subtree, Slapi_Backend
*be, mapping_t
{
Slapi_DN *dn;
mapping_tree_node *node;
- backend ** be_list = (backend **) slapi_ch_malloc(sizeof(backend **));
+ backend ** be_list = (backend **) slapi_ch_malloc(sizeof(backend *));
be_list[0] = be;
commit dcedbebf2db08be32c7ee4aad722f51d2c0d78ee
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Thu Mar 17 09:24:49 2011 -0700
Bug 688341 - (cov#10703) Fix Coverity code maintainability issues
We are computing the size of memory needed by using the incorrect
pointer type.
diff --git a/ldap/servers/slapd/vattr.c b/ldap/servers/slapd/vattr.c
index 72f98f8..e221096 100644
--- a/ldap/servers/slapd/vattr.c
+++ b/ldap/servers/slapd/vattr.c
@@ -1704,9 +1704,9 @@ int vattr_call_sp_get_batch_values(vattr_sp_handle *handle,
vattr_context *c, Sl
else
{
/* make our args look like the simple non-batched case */
- *results = (Slapi_ValueSet**)slapi_ch_calloc(2, sizeof(*results)); /* 2 for null
terminated list */
+ *results = (Slapi_ValueSet**)slapi_ch_calloc(2, sizeof(**results)); /* 2 for null
terminated list */
*type_name_disposition = (int *)slapi_ch_calloc(2, sizeof(*type_name_disposition));
- *actual_type_name = (char**)slapi_ch_calloc(2, sizeof(*actual_type_name));
+ *actual_type_name = (char**)slapi_ch_calloc(2, sizeof(**actual_type_name));
ret
=((handle->sp->sp_get_fn)(handle,c,e,*type,*results,*type_name_disposition,*actual_type_name,flags,buffer_flags,
hint));
if (ret)
commit 1c4d25369dd749a13a71f60af4c3d43326e9e4a0
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Thu Mar 17 09:17:22 2011 -0700
Bug 688341 - (cov#10704,10705) Fix Coverity code maintainability issues
We are computing the size of memory needed by using the incorrect
pointer type.
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index ceea429..c628ba5 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -2419,11 +2419,11 @@ slapi_entry_vattrcache_find_values_and_type_ex( const Slapi_Entry
*e,
char *vattr_type=NULL;
r= SLAPI_ENTRY_VATTR_RESOLVED_EXISTS;
- *results = (Slapi_ValueSet**)slapi_ch_calloc(1, sizeof(*results));
+ *results = (Slapi_ValueSet**)slapi_ch_calloc(1, sizeof(**results));
**results = valueset_dup(&(tmp_attr->a_present_values));
*actual_type_name =
- (char**)slapi_ch_malloc(sizeof(*actual_type_name));
+ (char**)slapi_ch_malloc(sizeof(**actual_type_name));
slapi_attr_get_type( tmp_attr, &vattr_type );
**actual_type_name = slapi_ch_strdup(vattr_type);
commit 5004279ad887abc9d2164c06f13d669731e94853
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Thu Mar 17 08:45:22 2011 -0700
Bug 688341 - (cov#10706,10707) Fix Coverity code maintainability issues
We are calling computing the size of memory needed by calculating
the number of pointers to put in the array, but we are not using
the correct pointer type.
diff --git a/ldap/servers/slapd/vattr.c b/ldap/servers/slapd/vattr.c
index 4957132..72f98f8 100644
--- a/ldap/servers/slapd/vattr.c
+++ b/ldap/servers/slapd/vattr.c
@@ -983,9 +983,9 @@ int slapi_vattr_namespace_values_get_sp(vattr_context *c,
if(attr_count > 0)
{
- *results = (Slapi_ValueSet**)slapi_ch_calloc(1, sizeof(*results) * attr_count);
+ *results = (Slapi_ValueSet**)slapi_ch_calloc(1, sizeof(**results) * attr_count);
*type_name_disposition = (int *)slapi_ch_malloc(sizeof(**type_name_disposition) *
attr_count);
- *actual_type_name = (char**)slapi_ch_malloc(sizeof(*actual_type_name) * attr_count);
+ *actual_type_name = (char**)slapi_ch_malloc(sizeof(**actual_type_name) *
attr_count);
/* For attributes which are in the entry, we just need to get to the Slapi_Attr
structure and yank out the slapi_value_set
structure. We either return a pointer directly to it, or we copy it, depending upon
whether the caller asked us to try to
commit 8786f0e05e2cc6a2f31b22357e9c7d269d186ccd
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Wed Mar 16 14:38:11 2011 -0700
Bug 688341 - (cov#10708) Fix Coverity code maintainability issues
We are calling computing the size of memory needed be calculating
the number of Slapi_Value pointers to put inthe array, but we
are multiplying that by the size of "Slapi_Value **" when it should
be the size of "Slapi_Value *".
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
index 14f3e76..fa90d7f 100644
--- a/ldap/servers/slapd/schema.c
+++ b/ldap/servers/slapd/schema.c
@@ -4805,7 +4805,7 @@ va_expand_one_oc( const char *dn, Slapi_Value ***vap, const char
*ocs )
}
newva = (Slapi_Value **)slapi_ch_realloc( (char *)*vap,
- ( i + 2 )*sizeof(Slapi_Value **));
+ ( i + 2 )*sizeof(Slapi_Value *));
newva[i] = slapi_value_new_string(sup_oc->oc_name);
newva[i+1] = NULL;
commit 72506b80ec141909d468e587252b55f3d9b62cb5
Author: Nathan Kinder <nkinder(a)redhat.com>
Date: Wed Mar 16 13:16:23 2011 -0700
Bug 688341 - (cov#10709) Fix Coverity code maintainability issues
The third argument to qsort() is incorrect. We should be specifying
the size of "Slapi_Entry *", not "Slapi_Entry **".
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 9e0b57f..ceea429 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -3697,7 +3697,7 @@ slapi_entries_diff(Slapi_Entry **old_entries, Slapi_Entry
**curr_entries,
for (cep = curr_entries; cep != NULL && *cep != NULL; cep++)
;
- qsort(curr_entries, cep - curr_entries, sizeof(Slapi_Entry **),
+ qsort(curr_entries, cep - curr_entries, sizeof(Slapi_Entry *),
entry_cmp_with_dn);
#ifdef ENTRY_DIFF_DEBUG