summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-06-08 12:51:31 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-06-08 12:51:31 +0000
commit46d106f2eb03e88b29e33e15d103b5e01ee3ff7e (patch)
treeb77678cf2fea73a95efa73c936db1b485f0956ae /source3
parente4bc8f08c35aeff9aa430058a82a16a515ef474d (diff)
downloadsamba-46d106f2eb03e88b29e33e15d103b5e01ee3ff7e.tar.gz
samba-46d106f2eb03e88b29e33e15d103b5e01ee3ff7e.tar.bz2
samba-46d106f2eb03e88b29e33e15d103b5e01ee3ff7e.zip
Fix some memory leaks and extra cache startups/shutdowns from the trusted
domains lookup code. Andrew Bartlett (This used to be commit 0ec1b1207041a3b6050046ba6d7b466dd4fcf341)
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/trustdom_cache.c5
-rw-r--r--source3/libsmb/trusts_util.c4
2 files changed, 5 insertions, 4 deletions
diff --git a/source3/libsmb/trustdom_cache.c b/source3/libsmb/trustdom_cache.c
index cddbb2daa6..61b024da43 100644
--- a/source3/libsmb/trustdom_cache.c
+++ b/source3/libsmb/trustdom_cache.c
@@ -89,7 +89,7 @@ BOOL trustdom_cache_shutdown(void)
static char* trustdom_cache_key(const char* name)
{
- char* keystr;
+ char* keystr = NULL;
asprintf(&keystr, TDOMKEY_FMT, strupper_static(name));
return keystr;
@@ -165,11 +165,14 @@ BOOL trustdom_cache_fetch(const char* name, DOM_SID* sid)
/* prepare a key and get the value */
key = trustdom_cache_key(name);
+ if (!key) return False;
if (!gencache_get(key, &value, &timeout)) {
DEBUG(5, ("no entry for trusted domain %s found.\n", name));
+ SAFE_FREE(key);
return False;
} else {
+ SAFE_FREE(key);
DEBUG(5, ("trusted domain %s found (%s)\n", name, value));
}
diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c
index 6244c844f2..e0c5e79595 100644
--- a/source3/libsmb/trusts_util.c
+++ b/source3/libsmb/trusts_util.c
@@ -154,9 +154,7 @@ BOOL is_trusted_domain(const char* dom_name)
* Query the trustdom_cache updated periodically. The only
* way for domain member server.
*/
- if (trustdom_cache_enable() &&
- trustdom_cache_fetch(dom_name, &trustdom_sid)) {
- trustdom_cache_shutdown();
+ if (trustdom_cache_fetch(dom_name, &trustdom_sid)) {
return True;
}