[PATCH 17/27] dbwrap_watch: don't leak lock_path onto talloc tos
David Disseldorp
ddiss at samba.org
Sun Nov 2 12:21:39 MST 2014
Also check for allocation failures.
Signed-off-by: David Disseldorp <ddiss at samba.org>
---
source3/lib/dbwrap/dbwrap_watch.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/source3/lib/dbwrap/dbwrap_watch.c b/source3/lib/dbwrap/dbwrap_watch.c
index 9ff8fc2..c0571d9 100644
--- a/source3/lib/dbwrap/dbwrap_watch.c
+++ b/source3/lib/dbwrap/dbwrap_watch.c
@@ -30,11 +30,17 @@ static struct db_context *dbwrap_record_watchers_db(void)
static struct db_context *watchers_db;
if (watchers_db == NULL) {
+ char *db_path = lock_path("dbwrap_watchers.tdb");
+ if (db_path == NULL) {
+ return NULL;
+ }
+
watchers_db = db_open(
- NULL, lock_path("dbwrap_watchers.tdb"), 0,
+ NULL, db_path, 0,
TDB_CLEAR_IF_FIRST | TDB_INCOMPATIBLE_HASH,
O_RDWR|O_CREAT, 0600, DBWRAP_LOCK_ORDER_3,
DBWRAP_FLAG_NONE);
+ TALLOC_FREE(db_path);
}
return watchers_db;
}
--
1.8.4.5
More information about the samba-technical
mailing list