summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-02-01 03:13:35 -0500
committerMichael Adam <obnox@samba.org>2013-02-04 17:14:22 +0100
commit29aeaab1d9bf2441f4a3a9f4a8554fa9af2bd5c2 (patch)
treee6c57358ef92a84d7ee3bd5b1f7c3a4f70c6651d
parent65f2bba559a33edb3c352d552aebb259e5e008eb (diff)
downloadsamba-29aeaab1d9bf2441f4a3a9f4a8554fa9af2bd5c2.tar.gz
samba-29aeaab1d9bf2441f4a3a9f4a8554fa9af2bd5c2.tar.bz2
samba-29aeaab1d9bf2441f4a3a9f4a8554fa9af2bd5c2.zip
lib/dbwrap: talloc_strdup() name in db_open_file()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
-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))) {