summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2020-07-15 13:33:27 -0700
committerVolker Lendecke <vl@samba.org>2020-07-16 06:52:36 +0000
commitdf0e54bea307b459433e1fdf9dc547875ee494cc (patch)
treedc2148e66df5270d012ef805c586450d25fb08f2
parent06f0a7e911da4f3279066f5ffaf4e03d01b354af (diff)
downloadsamba-df0e54bea307b459433e1fdf9dc547875ee494cc.tar.gz
s3: libsmb: Cleanup - namecache_store() - use common out.
Prepare for moving malloc values to talloc. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
-rw-r--r--source3/libsmb/namecache.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/source3/libsmb/namecache.c b/source3/libsmb/namecache.c
index 1127874c375..a4de493b08e 100644
--- a/source3/libsmb/namecache.c
+++ b/source3/libsmb/namecache.c
@@ -223,8 +223,8 @@ bool namecache_store(const char *name,
TALLOC_CTX *frame = talloc_stackframe();
if (name_type > 255) {
- TALLOC_FREE(frame);
- return false; /* Don't store non-real name types. */
+ /* Don't store non-real name types. */
+ goto out;
}
if ( DEBUGLEVEL >= 5 ) {
@@ -248,8 +248,7 @@ bool namecache_store(const char *name,
key = namecache_key(name, name_type);
if (!key) {
- TALLOC_FREE(frame);
- return false;
+ goto out;
}
expiry = time(NULL) + lp_name_cache_timeout();
@@ -260,14 +259,14 @@ bool namecache_store(const char *name,
* place each single ip
*/
if (!ipstr_list_make(&value_string, ip_list, num_names)) {
- SAFE_FREE(key);
- SAFE_FREE(value_string);
- TALLOC_FREE(frame);
- return false;
+ goto out;
}
/* set the entry */
ret = gencache_set(key, value_string, expiry);
+
+ out:
+
SAFE_FREE(key);
SAFE_FREE(value_string);
TALLOC_FREE(frame);