r13915: Fixed a very interesting class of realloc() bugs found by Coverity.
[samba.git] / source / lib / system_smbd.c
index 081a07c01950bcfd6f537192689589fbcccb8859..c627ae6270c48a4ad29c4ec18a341d469b43c404 100644 (file)
@@ -166,15 +166,10 @@ BOOL getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user,
        }
 
        if (sys_getgrouplist(user, primary_gid, temp_groups, &max_grp) == -1) {
-               gid_t *groups_tmp;
-
-               groups_tmp = SMB_REALLOC_ARRAY(temp_groups, gid_t, max_grp);
-               
-               if (!groups_tmp) {
-                       SAFE_FREE(temp_groups);
+               temp_groups = SMB_REALLOC_ARRAY(temp_groups, gid_t, max_grp);
+               if (!temp_groups) {
                        return False;
                }
-               temp_groups = groups_tmp;
                
                if (sys_getgrouplist(user, primary_gid,
                                     temp_groups, &max_grp) == -1) {