1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

tdb_wrap: Use talloc_pooled_object

One malloc() less

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Volker Lendecke 2015-07-12 12:37:43 +02:00 committed by Ralph Böhme
parent 00ec3c477e
commit 28e4616e20

View File

@ -92,14 +92,13 @@ static struct tdb_wrap_private *tdb_wrap_private_open(TALLOC_CTX *mem_ctx,
struct tdb_wrap_private *result;
struct tdb_logging_context lctx;
result = talloc(mem_ctx, struct tdb_wrap_private);
result = talloc_pooled_object(mem_ctx, struct tdb_wrap_private,
1, strlen(name)+1);
if (result == NULL) {
return NULL;
}
/* Doesn't fail, see talloc_pooled_object */
result->name = talloc_strdup(result, name);
if (result->name == NULL) {
goto fail;
}
lctx.log_fn = tdb_wrap_log;
lctx.log_private = NULL;