]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
More Realloc fixes.
authorJeremy Allison <jra@samba.org>
Sat, 18 Aug 2001 19:57:48 +0000 (19:57 +0000)
committerJeremy Allison <jra@samba.org>
Sat, 18 Aug 2001 19:57:48 +0000 (19:57 +0000)
Jeremy.

source/nsswitch/wb_client.c
source/nsswitch/winbindd_group.c

index 104e91c4d4ac502d8872bfe0c364c3da8ac091e6..9ae7c8d3f9c8acbf584c63d07a0d1ec836c4ae20 100644 (file)
@@ -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;
index ff357dc0984c70ebe332b01c35e6c82c630f27b7..9fc2ee79a0365a97319296a0bc5d6640cf28b841 100644 (file)
@@ -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;