]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
winbindd: Replace asprintf() with talloc_asprintf()
authorVolker Lendecke <vl@samba.org>
Sun, 16 Jan 2022 20:21:00 +0000 (21:21 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 18 Jan 2022 20:22:38 +0000 (20:22 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/winbindd/winbindd_util.c

index 175e05ae3ad31a5289c886bf850270b47619f1e6..bd9d36bb2483c34357ba6104536b3417bb1f7b1a 100644 (file)
@@ -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