[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-2738-g8abc6e7

Jeremy Allison jra at samba.org
Thu Jun 5 21:28:29 GMT 2008


The branch, v3-3-test has been updated
       via  8abc6e742147486a62b4a3f9845e34062845d8ea (commit)
      from  cc1b8de2632e87002cac86838f2a77ab9771ce2c (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit 8abc6e742147486a62b4a3f9845e34062845d8ea
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Jun 5 14:27:26 2008 -0700

    More correct fix (hopefully :-) for any memory leaks.
    Jerry promised to check :-). Vl also please review.
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source/libsmb/namequery.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/libsmb/namequery.c b/source/libsmb/namequery.c
index c987890..24d7ee1 100644
--- a/source/libsmb/namequery.c
+++ b/source/libsmb/namequery.c
@@ -1835,6 +1835,9 @@ static NTSTATUS get_dc_list(const char *domain,
 	NTSTATUS status;
 	TALLOC_CTX *ctx = talloc_init("get_dc_list");
 
+	*ip_list = NULL;
+	*count = 0;
+
 	if (!ctx) {
 		return NT_STATUS_NO_MEMORY;
 	}
@@ -1914,7 +1917,7 @@ static NTSTATUS get_dc_list(const char *domain,
 
 	p = pserver;
 	while (next_token_talloc(ctx, &p, &name, LIST_SEP)) {
-		if (strequal(name, "*")) {
+		if (!done_auto_lookup && strequal(name, "*")) {
 			status = internal_resolve_name(domain, 0x1C, sitename,
 						       &auto_ip_list,
 						       &auto_count,
@@ -2055,6 +2058,12 @@ static NTSTATUS get_dc_list(const char *domain,
 
   out:
 
+	if (!NT_STATUS_IS_OK(status)) {
+		SAFE_FREE(return_iplist);
+		*ip_list = NULL;
+		*count = 0;
+	}
+
 	SAFE_FREE(auto_ip_list);
 	TALLOC_FREE(ctx);
 	return status;
@@ -2074,6 +2083,9 @@ NTSTATUS get_sorted_dc_list( const char *domain,
 	NTSTATUS status;
 	enum dc_lookup_type lookup_type = DC_NORMAL_LOOKUP;
 
+	*ip_list = NULL;
+	*count = 0;
+
 	DEBUG(8,("get_sorted_dc_list: attempting lookup "
 		"for name %s (sitename %s) using [%s]\n",
 		domain,
@@ -2087,6 +2099,8 @@ NTSTATUS get_sorted_dc_list( const char *domain,
 	status = get_dc_list(domain, sitename, ip_list,
 			count, lookup_type, &ordered);
 	if (!NT_STATUS_IS_OK(status)) {
+		SAFE_FREE(*ip_list);
+		*count = 0;
 		return status;
 	}
 
@@ -2117,6 +2131,8 @@ NTSTATUS get_kdc_list( const char *realm,
 			count, DC_KDC_ONLY, &ordered);
 
 	if (!NT_STATUS_IS_OK(status)) {
+		SAFE_FREE(*ip_list);
+		*count = 0;
 		return status;
 	}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list