From 8cc41b027769b659d1b1503f0fd33ca7d3c3eb9b Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Mon, 6 Oct 2014 18:21:18 +0200 Subject: lanman: don't leak cache_path onto talloc tos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also check for allocation failures. Reported-by: Franz Pförtsch Signed-off-by: David Disseldorp Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Mon Oct 6 21:41:22 CEST 2014 on sn-devel-104 --- source3/smbd/lanman.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index ac4873decc..641f161f76 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -1226,12 +1226,19 @@ static int get_session_info(uint32 servertype, char **lines; bool local_list_only; int i; + char *slist_cache_path = cache_path(SERVER_LIST); + if (slist_cache_path == NULL) { + return 0; + } - lines = file_lines_load(cache_path(SERVER_LIST), NULL, 0, NULL); + lines = file_lines_load(slist_cache_path, NULL, 0, NULL); if (!lines) { - DEBUG(4,("Can't open %s - %s\n",cache_path(SERVER_LIST),strerror(errno))); + DEBUG(4, ("Can't open %s - %s\n", + slist_cache_path, strerror(errno))); + TALLOC_FREE(slist_cache_path); return 0; } + TALLOC_FREE(slist_cache_path); /* request for everything is code for request all servers */ if (servertype == SV_TYPE_ALL) { -- cgit