From 8c31fd48c8a2a509f3c9d2c21a450e3de6685389 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Mon, 10 Dec 2001 06:09:42 +0000 Subject: Allocate tdb name up front in case log functions want to use it. (This used to be commit a228c7efcc06b901ca51a6da77f8a52b77912f55) --- source3/tdb/tdb.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'source3/tdb') diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c index de376d29b2..1ca2974591 100644 --- a/source3/tdb/tdb.c +++ b/source3/tdb/tdb.c @@ -1422,6 +1422,11 @@ TDB_CONTEXT *tdb_open_ex(char *name, int hash_size, int tdb_flags, tdb->flags = tdb_flags; tdb->open_flags = open_flags; tdb->log_fn = log_fn; + + if (!(tdb->name = (char *)strdup(name))) { + errno = ENOMEM; + goto fail; + } if ((open_flags & O_ACCMODE) == O_WRONLY) { TDB_LOG((tdb, 0, "tdb_open_ex: can't open tdb %s write-only\n", @@ -1497,12 +1502,6 @@ TDB_CONTEXT *tdb_open_ex(char *name, int hash_size, int tdb_flags, goto fail; } - /* map the database and fill in the return structure */ - tdb->name = (char *)strdup(name); - if (!tdb->name) { - errno = ENOMEM; - goto fail; - } tdb->map_size = st.st_size; tdb->device = st.st_dev; tdb->inode = st.st_ino; -- cgit