Don't leak temporary data to callers but use a temporary context
that is freed at the end.
Michael
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;
}