First part of fix for bug #7159 - client rpc_transport doesn't cope with bad server...
[samba.git] / source3 / rpc_client / rpc_transport_np.c
index 80ff3840462d938b8ed5ff262f5fbacf0816752c..fdfbab4ceac0f2cb01ca7dd5c9065b887994fd56 100644 (file)
@@ -159,6 +159,9 @@ static void rpc_np_read_done(struct async_req *subreq)
        NTSTATUS status;
        uint8_t *rcvbuf;
 
+       /* We must free subreq in this function as there is
+          a timer event attached to it. */
+
        status = cli_read_andx_recv(subreq, &state->received, &rcvbuf);
        /*
         * We can't TALLOC_FREE(subreq) as usual here, as rcvbuf still is a
@@ -180,6 +183,7 @@ static void rpc_np_read_done(struct async_req *subreq)
        }
 
        memcpy(state->data, rcvbuf, state->received);
+       TALLOC_FREE(subreq);
        async_req_done(req);
 }