summaryrefslogtreecommitdiff
path: root/source3/nsswitch/winbindd_user.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-12-07 18:25:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:53:32 -0500
commitacf9d61421faa6c0055d57fdee7db300dc5431aa (patch)
tree5482afecfe9b4a68b9a1f18d541a3109f8143ab7 /source3/nsswitch/winbindd_user.c
parent3bd3be97dc8a581c0502410453091c195e322766 (diff)
downloadsamba-acf9d61421faa6c0055d57fdee7db300dc5431aa.tar.gz
samba-acf9d61421faa6c0055d57fdee7db300dc5431aa.tar.bz2
samba-acf9d61421faa6c0055d57fdee7db300dc5431aa.zip
r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation
functions so we can funnel through some well known functions. Should help greatly with malloc checking. HEAD patch to follow. Jeremy. (This used to be commit 620f2e608f70ba92f032720c031283d295c5c06a)
Diffstat (limited to 'source3/nsswitch/winbindd_user.c')
-rw-r--r--source3/nsswitch/winbindd_user.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/source3/nsswitch/winbindd_user.c b/source3/nsswitch/winbindd_user.c
index 249b9ccd8e..fc3fe0f963 100644
--- a/source3/nsswitch/winbindd_user.c
+++ b/source3/nsswitch/winbindd_user.c
@@ -351,8 +351,7 @@ enum winbindd_result winbindd_setpwent(struct winbindd_cli_state *state)
/* Create a state record for this domain */
- if ((domain_state = (struct getent_state *)
- malloc(sizeof(struct getent_state))) == NULL)
+ if ((domain_state = SMB_MALLOC_P(struct getent_state)) == NULL)
return WINBINDD_ERROR;
ZERO_STRUCTP(domain_state);
@@ -429,10 +428,7 @@ static BOOL get_sam_user_entries(struct getent_state *ent)
if (num_entries) {
struct getpwent_user *tnl;
- tnl = (struct getpwent_user *)Realloc(name_list,
- sizeof(struct getpwent_user) *
- (ent->num_sam_entries +
- num_entries));
+ tnl = SMB_REALLOC_ARRAY(name_list, struct getpwent_user, ent->num_sam_entries + num_entries);
if (!tnl) {
DEBUG(0,("get_sam_user_entries realloc failed.\n"));
@@ -498,8 +494,7 @@ enum winbindd_result winbindd_getpwent(struct winbindd_cli_state *state)
num_users = MIN(MAX_GETPWENT_USERS, state->request.data.num_entries);
- if ((state->response.extra_data =
- malloc(num_users * sizeof(struct winbindd_pw))) == NULL)
+ if ((state->response.extra_data = SMB_MALLOC_ARRAY(struct winbindd_pw, num_users)) == NULL)
return WINBINDD_ERROR;
memset(state->response.extra_data, 0, num_users *
@@ -624,7 +619,7 @@ enum winbindd_result winbindd_list_users(struct winbindd_cli_state *state)
/* Allocate some memory for extra data */
total_entries += num_entries;
- ted = Realloc(extra_data, sizeof(fstring) * total_entries);
+ ted = SMB_REALLOC(extra_data, sizeof(fstring) * total_entries);
if (!ted) {
DEBUG(0,("failed to enlarge buffer!\n"));