r20207: Fix a couple more places where extra_data was
authorJeremy Allison <jra@samba.org>
Sat, 16 Dec 2006 01:52:06 +0000 (01:52 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:16:32 +0000 (12:16 -0500)
being talloc'ed off the NULL context instead
of being malloced.
Jeremy.
(This used to be commit 47bdeb4efeaa5a441ad2d39bb3b94d72263e66e4)

source3/nsswitch/winbindd_async.c
source3/nsswitch/winbindd_group.c

index 93dea6f48cb8b19baf9272d6a85aab0e85ec3766..3319fda40634a3c8539fe1c70758bd95a9b296a5 100644 (file)
@@ -1135,13 +1135,13 @@ enum winbindd_result winbindd_dual_getsidaliases(struct winbindd_domain *domain,
        }
 
 
-       if (!print_sidlist(NULL, sids, num_sids, &sidstr, &len)) {
+       if (!print_sidlist(state->mem_ctx, sids, num_sids, &sidstr, &len)) {
                DEBUG(0, ("Could not print_sidlist\n"));
                state->response.extra_data.data = NULL;
                return WINBINDD_ERROR;
        }
 
-       state->response.extra_data.data = sidstr;
+       state->response.extra_data.data = SMB_STRDUP(sidstr);
 
        if (state->response.extra_data.data != NULL) {
                DEBUG(10, ("aliases_list: %s\n",
index deee07413c4dc1f68a85d9d40f2d4e2b935269a8..1b21352c860d6c807e63a2e97698e5275de34c9c 100644 (file)
@@ -1384,12 +1384,15 @@ enum winbindd_result winbindd_dual_getuserdomgroups(struct winbindd_domain *doma
                return WINBINDD_OK;
        }
 
-       if (!print_sidlist(NULL, groups, num_groups, &sidstring, &len)) {
-               DEBUG(0, ("malloc failed\n"));
+       if (!print_sidlist(state->mem_ctx, groups, num_groups, &sidstring, &len)) {
+               DEBUG(0, ("talloc failed\n"));
                return WINBINDD_ERROR;
        }
 
-       state->response.extra_data.data = sidstring;
+       state->response.extra_data.data = SMB_STRDUP(sidstring);
+       if (!state->response.extra_data.data) {
+               return WINBINDD_ERROR;
+       }
        state->response.length += len+1;
        state->response.data.num_entries = num_groups;