summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source3/lib/g_lock.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c
index 6813f0641f..30c5f52431 100644
--- a/source3/lib/g_lock.c
+++ b/source3/lib/g_lock.c
@@ -51,6 +51,7 @@ struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx,
struct messaging_context *msg)
{
struct g_lock_ctx *result;
+ char *db_path;
result = talloc(mem_ctx, struct g_lock_ctx);
if (result == NULL) {
@@ -58,11 +59,18 @@ struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx,
}
result->msg = msg;
- result->db = db_open(result, lock_path("g_lock.tdb"), 0,
+ db_path = lock_path("g_lock.tdb");
+ if (db_path == NULL) {
+ TALLOC_FREE(result);
+ return NULL;
+ }
+
+ result->db = db_open(result, db_path, 0,
TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
O_RDWR|O_CREAT, 0600,
DBWRAP_LOCK_ORDER_2,
DBWRAP_FLAG_NONE);
+ TALLOC_FREE(db_path);
if (result->db == NULL) {
DEBUG(1, ("g_lock_init: Could not open g_lock.tdb\n"));
TALLOC_FREE(result);