1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

dbwrap_watch: don't leak lock_path onto talloc tos

Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
David Disseldorp 2014-11-02 20:21:39 +01:00 committed by Jeremy Allison
parent 760af79621
commit 176259f2c4

View File

@ -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;
}