From b5f6cbbe1be4379a1ebab1f70ef05af838d48fb7 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 6 Sep 2006 13:20:06 +0000 Subject: r18177: Some build- and memleak-fixes for the (not build by default) ADS GPO routines. Guenther (This used to be commit 0ef504a0a6dc8f5db1dbc7f2410aa981e11fd56c) --- source3/libads/gpo_util.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source3/libads') diff --git a/source3/libads/gpo_util.c b/source3/libads/gpo_util.c index 8f913c1971..7df38eb125 100644 --- a/source3/libads/gpo_util.c +++ b/source3/libads/gpo_util.c @@ -445,7 +445,7 @@ ADS_STATUS gpo_password_policy(ADS_STRUCT *ads, struct GROUP_POLICY_OBJECT *gpo_list; const char *attrs[] = {"distinguishedName", "userAccountControl", NULL}; char *filter, *dn; - void *res = NULL; + LDAPMessage *res = NULL; uint32 uac; return ADS_ERROR_NT(NT_STATUS_NOT_IMPLEMENTED); @@ -473,15 +473,18 @@ ADS_STATUS gpo_password_policy(ADS_STRUCT *ads, } if (!ads_pull_uint32(ads, res, "userAccountControl", &uac)) { + ads_memfree(ads, dn); return ADS_ERROR(LDAP_NO_MEMORY); } if (!(uac & UF_WORKSTATION_TRUST_ACCOUNT)) { + ads_memfree(ads, dn); return ADS_ERROR(LDAP_NO_SUCH_OBJECT); } status = ads_get_gpo_list(ads, mem_ctx, dn, GPO_LIST_FLAG_MACHINE, &gpo_list); if (!ADS_ERR_OK(status)) { + ads_memfree(ads, dn); return status; } @@ -489,8 +492,10 @@ ADS_STATUS gpo_password_policy(ADS_STRUCT *ads, cse_gpo_name_to_guid_string("Security"), GPO_LIST_FLAG_MACHINE); if (!ADS_ERR_OK(status)) { + ads_memfree(ads, dn); return status; } + ads_memfree(ads, dn); return ADS_ERROR(LDAP_SUCCESS); } -- cgit