diff options
author | David Disseldorp <ddiss@samba.org> | 2014-11-02 20:21:35 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-11-03 23:46:05 +0100 |
commit | 364d55ccabbe319b68b154bd2d15c19b67327ede (patch) | |
tree | df48f221601591751550ebe00d11ef34f3564ae6 /source3 | |
parent | 0210e3c9cec96e31173fdf13f225bb56008c3cef (diff) | |
download | samba-364d55ccabbe319b68b154bd2d15c19b67327ede.tar.gz samba-364d55ccabbe319b68b154bd2d15c19b67327ede.tar.xz samba-364d55ccabbe319b68b154bd2d15c19b67327ede.zip |
idmap_autorid: don't leak state_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')
-rw-r--r-- | source3/winbindd/idmap_autorid.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c index 37612c2f53..eeac2b063b 100644 --- a/source3/winbindd/idmap_autorid.c +++ b/source3/winbindd/idmap_autorid.c @@ -713,6 +713,7 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom) struct idmap_tdb_common_context *commonconfig; struct autorid_global_config *config; NTSTATUS status; + char *db_path; if (!strequal(dom->name, "*")) { DEBUG(0, ("idmap_autorid_initialize: Error: autorid configured " @@ -779,9 +780,16 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom) commonconfig->rw_ops->get_new_id = idmap_autorid_allocate_id; commonconfig->rw_ops->set_mapping = idmap_tdb_common_set_mapping; - status = idmap_autorid_db_open(state_path("autorid.tdb"), + db_path = state_path("autorid.tdb"); + if (db_path == NULL) { + status = NT_STATUS_NO_MEMORY; + goto error; + } + + status = idmap_autorid_db_open(db_path, NULL, /* TALLOC_CTX */ &autorid_db); + TALLOC_FREE(db_path); if (!NT_STATUS_IS_OK(status)) { goto error; } |