]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib/dbwrap: talloc_strdup() name in db_open_file()
authorStefan Metzmacher <metze@samba.org>
Fri, 1 Feb 2013 08:13:35 +0000 (03:13 -0500)
committerMichael Adam <obnox@samba.org>
Mon, 4 Feb 2013 16:14:22 +0000 (17:14 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
lib/dbwrap/dbwrap_file.c

index 50e43b7baef56fd15a34364d1dc7ecbf601af6c6..a3b1737a881b74095740f6e2a1b8a09c72e2f5bb 100644 (file)
@@ -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))) {