From 6bcdd3460a29a5b4e84290d963bfe1a3941adc69 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 16 Jan 2022 21:21:00 +0100 Subject: [PATCH] winbindd: Replace asprintf() with talloc_asprintf() Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source3/winbindd/winbindd_util.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c index 175e05ae3ad..bd9d36bb248 100644 --- a/source3/winbindd/winbindd_util.c +++ b/source3/winbindd/winbindd_util.c @@ -2119,8 +2119,12 @@ static void winbindd_set_locator_kdc_env(const struct winbindd_domain *domain) return; } - if (asprintf_strupper_m(&var, "%s_%s", WINBINDD_LOCATOR_KDC_ADDRESS, - domain->alt_name) == -1) { + var = talloc_asprintf_strupper_m( + talloc_tos(), + "%s_%s", + WINBINDD_LOCATOR_KDC_ADDRESS, + domain->alt_name); + if (var == NULL) { return; } @@ -2128,7 +2132,7 @@ static void winbindd_set_locator_kdc_env(const struct winbindd_domain *domain) var, kdc)); setenv(var, kdc, 1); - free(var); + TALLOC_FREE(var); } /********************************************************************* @@ -2156,13 +2160,17 @@ void winbindd_unset_locator_kdc_env(const struct winbindd_domain *domain) return; } - if (asprintf_strupper_m(&var, "%s_%s", WINBINDD_LOCATOR_KDC_ADDRESS, - domain->alt_name) == -1) { + var = talloc_asprintf_strupper_m( + talloc_tos(), + "%s_%s", + WINBINDD_LOCATOR_KDC_ADDRESS, + domain->alt_name); + if (var == NULL) { return; } unsetenv(var); - free(var); + TALLOC_FREE(var); } #else -- 2.11.4.GIT