]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: libsmb: Cleanup - namecache_store() - use common out.
authorJeremy Allison <jra@samba.org>
Wed, 15 Jul 2020 20:33:27 +0000 (13:33 -0700)
committerVolker Lendecke <vl@samba.org>
Thu, 16 Jul 2020 06:52:36 +0000 (06:52 +0000)
Prepare for moving malloc values to talloc.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/libsmb/namecache.c

index 1127874c375361abc0a2bf8b2220dcae051cd359..a4de493b08ea417450bae8c934c5ce0e00cb3a53 100644 (file)
@@ -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);