From 29aeaab1d9bf2441f4a3a9f4a8554fa9af2bd5c2 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 1 Feb 2013 03:13:35 -0500 Subject: [PATCH] lib/dbwrap: talloc_strdup() name in db_open_file() Signed-off-by: Stefan Metzmacher Reviewed-by: Michael Adam --- lib/dbwrap/dbwrap_file.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/dbwrap/dbwrap_file.c b/lib/dbwrap/dbwrap_file.c index 50e43b7baef..a3b1737a881 100644 --- a/lib/dbwrap/dbwrap_file.c +++ b/lib/dbwrap/dbwrap_file.c @@ -371,8 +371,13 @@ struct db_context *db_open_file(TALLOC_CTX *mem_ctx, result->traverse = db_file_traverse; result->traverse_read = db_file_traverse; result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0); - result->name = name; result->hash_size = 0; + result->name = talloc_strdup(result, name); + if (result->name == NULL) { + DEBUG(0, ("talloc failed\n")); + TALLOC_FREE(result); + return NULL; + } ctx->locked_record = NULL; if (!(ctx->dirname = talloc_strdup(ctx, name))) { -- 2.11.4.GIT