summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-08-18 19:57:48 +0000
committerJeremy Allison <jra@samba.org>2001-08-18 19:57:48 +0000
commitca66a07781a13bb0b953535fca26ffcf97df39ac (patch)
treef95f4eb53fbca8de0615645b96e7f427a1431a02 /source3/nsswitch
parentec70b76395a099c1d3070e3df2f571ebd2d84e37 (diff)
downloadsamba-ca66a07781a13bb0b953535fca26ffcf97df39ac.tar.gz
samba-ca66a07781a13bb0b953535fca26ffcf97df39ac.tar.bz2
samba-ca66a07781a13bb0b953535fca26ffcf97df39ac.zip
More Realloc fixes.
Jeremy. (This used to be commit b4fa49fe13cb93d578b1714d5863a9f50395bf65)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/wb_client.c2
-rw-r--r--source3/nsswitch/winbindd_group.c15
2 files changed, 13 insertions, 4 deletions
diff --git a/source3/nsswitch/wb_client.c b/source3/nsswitch/wb_client.c
index 104e91c4d4..9ae7c8d3f9 100644
--- a/source3/nsswitch/wb_client.c
+++ b/source3/nsswitch/wb_client.c
@@ -314,7 +314,7 @@ int winbind_initgroups(char *user, gid_t gid)
/* Add group to list if necessary */
if (!is_member) {
- tgr = Realloc(groups, sizeof(gid_t) * ngroups + 1);
+ tgr = (gid_t *)Realloc(groups, sizeof(gid_t) * ngroups + 1);
if (!tgr) {
errno = ENOMEM;
diff --git a/source3/nsswitch/winbindd_group.c b/source3/nsswitch/winbindd_group.c
index ff357dc098..9fc2ee79a0 100644
--- a/source3/nsswitch/winbindd_group.c
+++ b/source3/nsswitch/winbindd_group.c
@@ -513,12 +513,21 @@ static BOOL get_sam_group_entries(struct getent_state *ent)
/* Copy entries into return buffer */
if (num_entries) {
+ struct acct_info *tnl;
- name_list = Realloc(name_list,
+ tnl = (struct acct_info *)Realloc(name_list,
sizeof(struct acct_info) *
(ent->num_sam_entries +
num_entries));
+ if (!tnl) {
+ DEBUG(0,("get_sam_group_entries: Realloc fail.\n"));
+ if (name_list)
+ free(name_list);
+ return False;
+ } else
+ name_list = tnl;
+
memcpy(&name_list[ent->num_sam_entries],
sam_grp_entries,
num_entries * sizeof(struct acct_info));
@@ -761,8 +770,8 @@ enum winbindd_result winbindd_getgrent(struct winbindd_cli_state *state)
enum winbindd_result winbindd_list_groups(struct winbindd_cli_state *state)
{
- uint32 total_entries = 0;
- struct winbindd_domain *domain;
+ uint32 total_entries = 0;
+ struct winbindd_domain *domain;
struct getent_state groups;
char *ted, *extra_data = NULL;
int extra_data_len = 0, i;