diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-11-18 23:27:58 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:46:28 -0500 |
commit | f8391489bfbeea20e450b9ec7640c3e04c713ced (patch) | |
tree | 37fb5d2275a516ec1f54e42f7b003dae073c9481 /source4/libnet/libnet_lookup.c | |
parent | 552c0111a10c70d2ca24c996838d41d79494969f (diff) | |
download | samba-f8391489bfbeea20e450b9ec7640c3e04c713ced.tar.gz samba-f8391489bfbeea20e450b9ec7640c3e04c713ced.tar.bz2 samba-f8391489bfbeea20e450b9ec7640c3e04c713ced.zip |
r11794: - fixed a valgrind error in libnet, caused by using a stack variable
after the function has returned (the *address variable was assigned
into the state).
- changed libnet to use event_context_find() instead of
event_context_init(), so it works as a child of existing code that
uses a event context
(This used to be commit 47ceb2d3558304b4c4fb00582fb25a885cea2ef5)
Diffstat (limited to 'source4/libnet/libnet_lookup.c')
-rw-r--r-- | source4/libnet/libnet_lookup.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/source4/libnet/libnet_lookup.c b/source4/libnet/libnet_lookup.c index 7cc05324d6..67c102a3e2 100644 --- a/source4/libnet/libnet_lookup.c +++ b/source4/libnet/libnet_lookup.c @@ -34,7 +34,6 @@ struct lookup_state { struct composite_context *resolve_ctx; struct nbt_name hostname; - const char **address; }; @@ -50,7 +49,6 @@ struct composite_context *libnet_Lookup_send(struct libnet_context *ctx, struct composite_context *c; struct lookup_state *s; const char** methods; - const char* address = talloc_array(ctx, const char, 16); if (!io) return NULL; @@ -62,14 +60,13 @@ struct composite_context *libnet_Lookup_send(struct libnet_context *ctx, if (s == NULL) goto failed; /* prepare event context */ - c->event_ctx = event_context_init(c); + c->event_ctx = event_context_find(c); if (c->event_ctx == NULL) goto failed; /* parameters */ s->hostname.name = talloc_strdup(s, io->in.hostname); s->hostname.type = io->in.type; s->hostname.scope = NULL; - s->address = &address; /* name resolution methods */ if (io->in.methods) { @@ -106,12 +103,14 @@ NTSTATUS libnet_Lookup_recv(struct composite_context *c, TALLOC_CTX *mem_ctx, { NTSTATUS status; struct lookup_state *s; + const char *address; s = talloc_get_type(c->private_data, struct lookup_state); - status = resolve_name_recv(s->resolve_ctx, mem_ctx, s->address); + status = resolve_name_recv(s->resolve_ctx, mem_ctx, &address); if (NT_STATUS_IS_OK(status)) { - io->out.address = s->address; + io->out.address = str_list_make(mem_ctx, address, NULL); + NT_STATUS_HAVE_NO_MEMORY(io->out.address); } return status; |