From 5d73bb4acd7cf062b9fd1a9ea6721e41a5e721fb Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 6 Jun 2024 17:37:32 +0200 Subject: [PATCH] s3:utils: Use talloc instead of malloc functions Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Thu Jun 6 21:32:53 UTC 2024 on atb-devel-224 --- source3/utils/net_rpc.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 066585cb994..b04be2efea7 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -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); -- 2.47.3