if a caller doesn't provide an event context to the resolver library,
authortridge <tridge@0c0555d6-39d7-0310-84fc-f1cc0bd64818>
Sat, 22 Jan 2005 01:37:48 +0000 (01:37 +0000)
committertridge <tridge@0c0555d6-39d7-0310-84fc-f1cc0bd64818>
Sat, 22 Jan 2005 01:37:48 +0000 (01:37 +0000)
then create one. This fixes a crash in the RAW-NEGNOWAIT test for
'host' resolution.

git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/SAMBA_4_0@4919 0c0555d6-39d7-0310-84fc-f1cc0bd64818

source/libcli/resolve/resolve.c

index 013403fd9c656ccca3e8e74cad1d3fa9ca359c69..ef906d4ed00b26e8d31570e0c305b97ed1fb9371 100644 (file)
@@ -138,7 +138,12 @@ struct smbcli_composite *resolve_name_send(struct nbt_name *name, struct event_c
 
        c->state = SMBCLI_REQUEST_SEND;
        c->private = state;
-       c->event_ctx = talloc_reference(c, event_ctx);
+       if (event_ctx == NULL) {
+               c->event_ctx = event_context_init(c);
+               if (c->event_ctx == NULL) goto failed;
+       } else {
+               c->event_ctx = talloc_reference(c, event_ctx);
+       }
 
        state->req = setup_next_method(c);
        if (state->req == NULL) goto failed;