summaryrefslogtreecommitdiff
path: root/lib/dbwrap/dbwrap_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dbwrap/dbwrap_file.c')
-rw-r--r--lib/dbwrap/dbwrap_file.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/dbwrap/dbwrap_file.c b/lib/dbwrap/dbwrap_file.c
index 50e43b7bae..a3b1737a88 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))) {