From c2b26a43ffae22c9dff7929c48531fec9e6ed922 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 24 Nov 2012 14:42:06 +0000 Subject: dbwrap-ctdb: Avoid a talloc_stackframe() We have only a single allocation in this routine, so I think we can live without a stackframe. Signed-off-by: Volker Lendecke Reviewed-by: Stefan Metzmacher --- source3/lib/dbwrap/dbwrap_ctdb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c index 691acdb491..e55689cad5 100644 --- a/source3/lib/dbwrap/dbwrap_ctdb.c +++ b/source3/lib/dbwrap/dbwrap_ctdb.c @@ -140,15 +140,13 @@ static NTSTATUS db_ctdb_ltdb_store(struct db_ctdb_ctx *db, struct ctdb_ltdb_header *header, TDB_DATA data) { - TALLOC_CTX *tmp_ctx = talloc_stackframe(); TDB_DATA rec; int ret; rec.dsize = data.dsize + sizeof(struct ctdb_ltdb_header); - rec.dptr = (uint8_t *)talloc_size(tmp_ctx, rec.dsize); + rec.dptr = (uint8_t *)talloc_size(talloc_tos(), rec.dsize); if (rec.dptr == NULL) { - talloc_free(tmp_ctx); return NT_STATUS_NO_MEMORY; } @@ -157,7 +155,7 @@ static NTSTATUS db_ctdb_ltdb_store(struct db_ctdb_ctx *db, ret = tdb_store(db->wtdb->tdb, key, rec, TDB_REPLACE); - talloc_free(tmp_ctx); + talloc_free(rec.dptr); return (ret == 0) ? NT_STATUS_OK : tdb_error_to_ntstatus(db->wtdb->tdb); -- cgit