]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:client: Pass down a talloc context to process_command_string()
authorAndreas Schneider <asn@samba.org>
Wed, 29 Oct 2025 10:07:08 +0000 (11:07 +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 d8eb662b1b1dc8cef97e41d1cc5abc34c1d14b26..7641bd3a83f0d7c0aaabbc7a9ec652c1fba7fbca 100644 (file)
@@ -5786,7 +5786,7 @@ static int cmd_help(void)
  Process a -c command string.
 ****************************************************************************/
 
-static int process_command_string(const char *cmd_in)
+static int process_command_string(TALLOC_CTX *mem_ctx, const char *cmd_in)
 {
        TALLOC_CTX *frame = talloc_stackframe();
        char *cmd = talloc_strdup(frame, cmd_in);
@@ -5802,7 +5802,9 @@ static int process_command_string(const char *cmd_in)
        if (!cli) {
                NTSTATUS status;
 
-               status = cli_cm_open(frame, NULL,
+               /* cli_cm_open() needs to use a long lived talloc context */
+               status = cli_cm_open(mem_ctx,
+                                    NULL,
                                     desthost,
                                     service,
                                     creds,
@@ -6261,7 +6263,7 @@ static int process(TALLOC_CTX *mem_ctx, const char *base_directory)
        }
 
        if (cmdstr) {
-               rc = process_command_string(cmdstr);
+               rc = process_command_string(mem_ctx, cmdstr);
        } else {
                rc = process_stdin();
        }
@@ -6782,7 +6784,7 @@ int main(int argc,char *argv[])
 
        if (tar_to_process(tar_ctx)) {
                if (cmdstr)
-                       process_command_string(cmdstr);
+                       process_command_string(frame, cmdstr);
                rc = do_tar_op(frame, base_directory);
        } else if (query_host && *query_host) {
                char *qhost = query_host;