diff options
author | David Disseldorp <ddiss@samba.org> | 2014-11-02 20:21:39 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-11-03 23:46:05 +0100 |
commit | 176259f2c47d3a32dc105e211cc8097c60031dbf (patch) | |
tree | cbbee9a5b082d164ff67e720a78cf16cddd3eaaf /source3/lib | |
parent | 760af796213cc8adcf6967510e65358f165847dc (diff) | |
download | samba-176259f2c47d3a32dc105e211cc8097c60031dbf.tar.gz samba-176259f2c47d3a32dc105e211cc8097c60031dbf.tar.xz samba-176259f2c47d3a32dc105e211cc8097c60031dbf.zip |
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>
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/dbwrap/dbwrap_watch.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/lib/dbwrap/dbwrap_watch.c b/source3/lib/dbwrap/dbwrap_watch.c index 9ff8fc24b4..c0571d967c 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; } |