]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:client: Always goto out (destructor) in do_cd()
authorAndreas Schneider <asn@samba.org>
Tue, 28 Oct 2025 09:06:25 +0000 (10:06 +0100)
committerAnoop C S <anoopcs@samba.org>
Thu, 6 Nov 2025 08:56:31 +0000 (08:56 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/client/client.c

index 690fd3f3f7317259ac504cd99c631cbdf9f00456..1d10a4f90b2a2d1d859aaa8486dab0e21a51ba09 100644 (file)
@@ -399,8 +399,7 @@ static int do_cd(const char *new_dir)
 
        newdir = talloc_strdup(ctx, new_dir);
        if (!newdir) {
-               TALLOC_FREE(ctx);
-               return 1;
+               goto out;
        }
 
        normalize_name(newdir);
@@ -409,8 +408,7 @@ static int do_cd(const char *new_dir)
 
        saved_dir = talloc_strdup(ctx, client_get_cur_dir());
        if (!saved_dir) {
-               TALLOC_FREE(ctx);
-               return 1;
+               goto out;
        }
 
        if (*newdir == CLI_DIRSEP_CHAR) {
@@ -447,8 +445,8 @@ static int do_cd(const char *new_dir)
        }
 
        if (strequal(targetpath,CLI_DIRSEP_STR )) {
-               TALLOC_FREE(ctx);
-               return 0;
+               ret = 0;
+               goto out;
        }