From 87c7496761f2f165df5fafcf860c3d3f8285cee8 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 1 Aug 2008 17:13:42 +0200 Subject: 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) --- source3/libnet/libnet_dssync.c | 11 +++++++++-- 1 file 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; } -- cgit