diff options
author | Volker Lendecke <vl@samba.org> | 2008-06-05 09:00:37 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-06-07 08:16:23 +0200 |
commit | a191f3d2fede9cfa19261060a2788df75bc15089 (patch) | |
tree | 4ccc010bea0a737c55c9d64184f27b66a8d0a555 /source3 | |
parent | d4cbc4408eba4a06931cc93c59555c4abc2f5ee1 (diff) | |
download | samba-a191f3d2fede9cfa19261060a2788df75bc15089.tar.gz samba-a191f3d2fede9cfa19261060a2788df75bc15089.tar.bz2 samba-a191f3d2fede9cfa19261060a2788df75bc15089.zip |
Make the gencache based conncache use talloc_tos()
(This used to be commit f7f912a478af64b07beeb58673b605da0c46db94)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/conncache.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/source3/libsmb/conncache.c b/source3/libsmb/conncache.c index 2df45c2b0f..b8f98085ce 100644 --- a/source3/libsmb/conncache.c +++ b/source3/libsmb/conncache.c @@ -59,10 +59,12 @@ static char *negative_conn_cache_keystr(const char *domain, const char *server) SMB_ASSERT(domain != NULL); if (server == NULL) server = ""; - - if (asprintf(&keystr, NEGATIVE_CONN_CACHE_KEY_FMT, - NEGATIVE_CONN_CACHE_PREFIX, domain, server) == -1) + + keystr = talloc_asprintf(talloc_tos(),NEGATIVE_CONN_CACHE_KEY_FMT, + NEGATIVE_CONN_CACHE_PREFIX, domain, server); + if (keystr == NULL) { DEBUG(0, ("negative_conn_cache_keystr: malloc error\n")); + } return keystr; } @@ -80,8 +82,10 @@ static char *negative_conn_cache_valuestr(NTSTATUS status) { char *valuestr = NULL; - if (asprintf(&valuestr, "%x", NT_STATUS_V(status)) == -1) + valuestr = talloc_asprintf(talloc_tos(), "%x", NT_STATUS_V(status)); + if (valuestr == NULL) { DEBUG(0, ("negative_conn_cache_valuestr: malloc error\n")); + } return valuestr; } @@ -144,7 +148,7 @@ NTSTATUS check_negative_conn_cache( const char *domain, const char *server) done: DEBUG(9,("check_negative_conn_cache returning result %d for domain %s " "server %s\n", NT_STATUS_V(result), domain, server)); - SAFE_FREE(key); + TALLOC_FREE(key); SAFE_FREE(value); return result; } @@ -167,7 +171,7 @@ void delete_negative_conn_cache(const char *domain, const char *server) DEBUG(9,("delete_negative_conn_cache removing domain %s server %s\n", domain, server)); done: - SAFE_FREE(key); + TALLOC_FREE(key); return; } @@ -192,13 +196,13 @@ void add_failed_connection_entry(const char *domain, const char *server, DEBUG(0, ("add_failed_connection_entry: key creation error\n")); goto done; } - + value = negative_conn_cache_valuestr(result); if (value == NULL) { DEBUG(0, ("add_failed_connection_entry: value creation error\n")); goto done; } - + if (gencache_set(key, value, time((time_t *) NULL + FAILED_CONNECTION_CACHE_TIMEOUT))) DEBUG(9,("add_failed_connection_entry: added domain %s (%s) " @@ -209,8 +213,8 @@ void add_failed_connection_entry(const char *domain, const char *server, domain, server)); done: - SAFE_FREE(key); - SAFE_FREE(value); + TALLOC_FREE(key); + TALLOC_FREE(value); return; } @@ -246,6 +250,6 @@ void flush_negative_conn_cache_for_domain(const char *domain) domain)); done: - SAFE_FREE(key_pattern); + TALLOC_FREE(key_pattern); return; } |