r14196: Move to using talloc, not malloc for all policy handles.
authorJeremy Allison <jra@samba.org>
Sat, 11 Mar 2006 02:48:20 +0000 (02:48 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:15:16 +0000 (11:15 -0500)
Jeremy

source/libmsrpc/cac_lsarpc.c

index 1877e9cd7efcfa0d6e1c1f106403f0028248cc57..13aaa017548202d7acfcbcf631e4a4678cdf5b8a 100644 (file)
@@ -65,7 +65,7 @@ int cac_LsaOpenPolicy(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaOpenP
       return CAC_FAILURE;
    }
 
-   policy = SMB_MALLOC_P(POLICY_HND);
+   policy = TALLOC_P(mem_ctx, POLICY_HND);
    if(!policy) {
       errno = ENOMEM;
       hnd->status = NT_STATUS_NO_MEMORY;
@@ -95,7 +95,6 @@ int cac_LsaOpenPolicy(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaOpenP
    }
 
    if(!NT_STATUS_IS_OK(hnd->status)) {
-      SAFE_FREE(policy);
       return CAC_FAILURE;
    }
 
@@ -125,14 +124,13 @@ int cac_LsaClosePolicy(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *po
       return CAC_FAILURE;
    }
 
-
    hnd->status = rpccli_lsa_close(pipe_hnd, mem_ctx, pol);
 
+   TALLOC_FREE(pol);
+
    if(!NT_STATUS_IS_OK(hnd->status))
       return CAC_FAILURE;
 
-   SAFE_FREE(pol);
-
    return CAC_SUCCESS;
 }