summaryrefslogtreecommitdiff
path: root/source4/libads
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-12-03 07:20:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:06:20 -0500
commit6e6374cb5bcffb4df8bdb0a83327fff92b61ac84 (patch)
treefa45bc8c1a7281492f39069e5edd86da6d0c5d4e /source4/libads
parente5ce904ddbd6175ba86ed827bf096b76b11b5511 (diff)
downloadsamba-6e6374cb5bcffb4df8bdb0a83327fff92b61ac84.tar.gz
samba-6e6374cb5bcffb4df8bdb0a83327fff92b61ac84.tar.bz2
samba-6e6374cb5bcffb4df8bdb0a83327fff92b61ac84.zip
r4055: fixed more places to use type safe allocation macros
(This used to be commit eec698254f67365f27b4b7569fa982e22472aca1)
Diffstat (limited to 'source4/libads')
-rw-r--r--source4/libads/ldap.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source4/libads/ldap.c b/source4/libads/ldap.c
index d4b363cae6..cd551af7f0 100644
--- a/source4/libads/ldap.c
+++ b/source4/libads/ldap.c
@@ -276,7 +276,7 @@ static struct berval *dup_berval(TALLOC_CTX *ctx, const struct berval *in_val)
if (!in_val) return NULL;
- value = talloc_zero(ctx, sizeof(struct berval));
+ value = talloc_zero_p(ctx, struct berval);
if (value == NULL)
return NULL;
if (in_val->bv_len == 0) return value;
@@ -317,7 +317,7 @@ static char **ads_push_strvals(TALLOC_CTX *ctx, const char **in_vals)
if (!in_vals) return NULL;
for (i=0; in_vals[i]; i++); /* count values */
- values = (char ** ) talloc_zero(ctx, (i+1)*sizeof(char *));
+ values = talloc_zero_array_p(ctx, char *, i+1);
if (!values) return NULL;
for (i=0; in_vals[i]; i++) {
@@ -336,7 +336,7 @@ static char **ads_pull_strvals(TALLOC_CTX *ctx, const char **in_vals)
if (!in_vals) return NULL;
for (i=0; in_vals[i]; i++); /* count values */
- values = (char **) talloc_zero(ctx, (i+1)*sizeof(char *));
+ values = talloc_zero_array_p(ctx, char *, i+1);
if (!values) return NULL;
for (i=0; in_vals[i]; i++) {
@@ -758,11 +758,11 @@ ADS_MODLIST ads_init_mods(TALLOC_CTX *ctx)
#define ADS_MODLIST_ALLOC_SIZE 10
LDAPMod **mods;
- if ((mods = (LDAPMod **) talloc_zero(ctx, sizeof(LDAPMod *) *
- (ADS_MODLIST_ALLOC_SIZE + 1))))
+ if ((mods = talloc_zero_array_p(ctx, LDAPMod *, ADS_MODLIST_ALLOC_SIZE + 1))) {
/* -1 is safety to make sure we don't go over the end.
need to reset it to NULL before doing ldap modify */
mods[ADS_MODLIST_ALLOC_SIZE] = (LDAPMod *) -1;
+ }
return mods;
}
@@ -804,7 +804,7 @@ static ADS_STATUS ads_modlist_add(TALLOC_CTX *ctx, ADS_MODLIST *mods,
*mods = modlist;
}
- if (!(modlist[curmod] = talloc_zero(ctx, sizeof(LDAPMod))))
+ if (!(modlist[curmod] = talloc_zero_p(ctx, LDAPMod)))
return ADS_ERROR(LDAP_NO_MEMORY);
modlist[curmod]->mod_type = talloc_strdup(ctx, name);
if (mod_op & LDAP_MOD_BVALUES) {