]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:utils: Use talloc instead of malloc functions
authorAndreas Schneider <asn@samba.org>
Thu, 6 Jun 2024 15:37:32 +0000 (17:37 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 6 Jun 2024 21:32:53 +0000 (21:32 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Jun  6 21:32:53 UTC 2024 on atb-devel-224

source3/utils/net_rpc.c

index 066585cb994d356d484249bacd738886bc5e636c..b04be2efea709f39e2a0bd8ca03da96d8e4b8caa 100644 (file)
@@ -6566,19 +6566,14 @@ static int rpc_trustdom_establish(struct net_context *c, int argc,
                goto out;
        }
 
-       domain_name = smb_xstrdup(argv[0]);
-       if (!strupper_m(domain_name)) {
-               SAFE_FREE(domain_name);
+       domain_name = talloc_strdup_upper(frame, argv[0]);
+       if (domain_name == NULL) {
                goto out;
        }
 
        /* account name used at first is our domain's name with '$' */
-       if (asprintf(&acct_name, "%s$", lp_workgroup()) == -1) {
-               goto out;
-       }
-       if (!strupper_m(acct_name)) {
-               SAFE_FREE(domain_name);
-               SAFE_FREE(acct_name);
+       acct_name = talloc_asprintf_strupper_m(frame, "%s$", lp_workgroup());
+       if (acct_name == NULL) {
                goto out;
        }
        cli_credentials_set_username(c->creds, acct_name, CRED_SPECIFIED);