summaryrefslogtreecommitdiff
path: root/source3/libnet
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-08-01 17:13:42 +0200
committerMichael Adam <obnox@samba.org>2008-08-01 17:13:42 +0200
commit87c7496761f2f165df5fafcf860c3d3f8285cee8 (patch)
tree82595ba45fd1238025a41a30d475810420b519c5 /source3/libnet
parent84ee630ee973189ca9f2ce2afe4987998aaeccc7 (diff)
downloadsamba-87c7496761f2f165df5fafcf860c3d3f8285cee8.tar.gz
samba-87c7496761f2f165df5fafcf860c3d3f8285cee8.tar.bz2
samba-87c7496761f2f165df5fafcf860c3d3f8285cee8.zip
libnet dssync: start memory allocation cleanup: use tmp ctx in libnet_dssync().
Don't leak temporary data to callers but use a temporary context that is freed at the end. Michael (This used to be commit 2d98ad57f56ddd4318bc721929a3ca9ede189a25)
Diffstat (limited to 'source3/libnet')
-rw-r--r--source3/libnet/libnet_dssync.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c
index 3641505d99..684a2cc63b 100644
--- a/source3/libnet/libnet_dssync.c
+++ b/source3/libnet/libnet_dssync.c
@@ -696,18 +696,25 @@ NTSTATUS libnet_dssync(TALLOC_CTX *mem_ctx,
struct dssync_context *ctx)
{
NTSTATUS status;
+ TALLOC_CTX *tmp_ctx;
- status = libnet_dssync_init(mem_ctx, ctx);
+ tmp_ctx = talloc_new(mem_ctx);
+ if (!tmp_ctx) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ status = libnet_dssync_init(tmp_ctx, ctx);
if (!NT_STATUS_IS_OK(status)) {
goto out;
}
- status = libnet_dssync_process(mem_ctx, ctx);
+ status = libnet_dssync_process(tmp_ctx, ctx);
if (!NT_STATUS_IS_OK(status)) {
goto out;
}
out:
+ TALLOC_FREE(tmp_ctx);
return status;
}