summaryrefslogtreecommitdiff
path: root/source3/lib/dbwrap
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-11-24 14:42:06 +0000
committerStefan Metzmacher <metze@samba.org>2013-03-26 11:19:59 +0100
commitc2b26a43ffae22c9dff7929c48531fec9e6ed922 (patch)
treef02da192a02dc77ef2c95efe0c25441655b0a2b7 /source3/lib/dbwrap
parentd147194466560488cda9f6e5e993c985cea02289 (diff)
downloadsamba-c2b26a43ffae22c9dff7929c48531fec9e6ed922.tar.gz
samba-c2b26a43ffae22c9dff7929c48531fec9e6ed922.tar.bz2
samba-c2b26a43ffae22c9dff7929c48531fec9e6ed922.zip
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 <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/lib/dbwrap')
-rw-r--r--source3/lib/dbwrap/dbwrap_ctdb.c6
1 files changed, 2 insertions, 4 deletions
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);