svn commit: samba r11747 - in branches/SAMBA_4_0/source/libnet: .

mimir at samba.org mimir at samba.org
Wed Nov 16 19:55:28 GMT 2005


Author: mimir
Date: 2005-11-16 19:55:27 +0000 (Wed, 16 Nov 2005)
New Revision: 11747

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11747

Log:
Move buffer allocation to libnet_Lookup function so that the
caller is not required to ensure it.


rafal


Modified:
   branches/SAMBA_4_0/source/libnet/libnet_lookup.c


Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_lookup.c
===================================================================
--- branches/SAMBA_4_0/source/libnet/libnet_lookup.c	2005-11-16 18:40:37 UTC (rev 11746)
+++ branches/SAMBA_4_0/source/libnet/libnet_lookup.c	2005-11-16 19:55:27 UTC (rev 11747)
@@ -50,6 +50,7 @@
 	struct composite_context *c;
 	struct lookup_state *s;
 	const char** methods;
+	const char* address = talloc_array(ctx, const char, 16);
 
 	if (!io) return NULL;
 
@@ -68,7 +69,7 @@
 	s->hostname.name   = talloc_strdup(s, io->in.hostname);
 	s->hostname.type   = io->in.type;
 	s->hostname.scope  = NULL;
-	s->address         = io->out.address;
+	s->address         = &address;
 
 	/* name resolution methods */
 	if (io->in.methods) {
@@ -109,6 +110,10 @@
 	s = talloc_get_type(c->private_data, struct lookup_state);
 
 	status = resolve_name_recv(s->resolve_ctx, mem_ctx, s->address);
+	if (NT_STATUS_IS_OK(status)) {
+		io->out.address = s->address;
+	}
+
 	return status;
 }
 



More information about the samba-cvs mailing list