[PATCH master] Fix another leak in source3/passdb/machine_account_secrets.c

Michele Baldessari michele at acksyn.org
Thu Sep 6 15:45:34 MDT 2012


Free protect_ids in secret_store_domain_guid() as the caller
of fetch_secrets() must free the result in order to not leak memory.

---
 source3/passdb/machine_account_secrets.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/source3/passdb/machine_account_secrets.c b/source3/passdb/machine_account_secrets.c
index 70d7106..6320f4e 100644
--- a/source3/passdb/machine_account_secrets.c
+++ b/source3/passdb/machine_account_secrets.c
@@ -149,9 +149,11 @@ bool secrets_store_domain_guid(const char *domain, struct GUID *guid)
 		if (strncmp(protect_ids, "TRUE", 4)) {
 			DEBUG(0, ("Refusing to store a Domain SID, "
 				  "it has been marked as protected!\n"));
+			SAFE_FREE(protect_ids);
 			return false;
 		}
 	}
+	SAFE_FREE(protect_ids);
 #endif
 
 	slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_DOMAIN_GUID, domain);
-- 
1.7.11.4


-- 
Michele Baldessari            <michele at acksyn.org>
C2A5 9DA3 9961 4FFB E01B  D0BC DDD4 DCCB 7515 5C6D


More information about the samba-technical mailing list