return NT_STATUS_OK;
}
-/* Note that received_packets are allocated in talloc_autofree_context(),
+/* Note that received_packets are allocated on the NULL context
* because no other context appears to stay around long enough. */
static struct received_packet {
uint16_t opnum;
struct received_packet *prev, *next;
} *received_packets = NULL;
+static void free_received_packets(void)
+{
+ struct received_packet *rp;
+ struct received_packet *rp_next;
+
+ for (rp = received_packets; rp; rp = rp_next) {
+ rp_next = rp->next;
+ DLIST_REMOVE(received_packets, rp);
+ talloc_unlink(rp, rp->r);
+ talloc_free(rp);
+ }
+ received_packets = NULL;
+}
+
static WERROR _spoolss_ReplyOpenPrinter(struct dcesrv_call_state *dce_call,
TALLOC_CTX *mem_ctx,
struct spoolss_ReplyOpenPrinter *r)
uint16_t opnum = dce_call->pkt.u.request.opnum;
struct received_packet *rp;
- rp = talloc_zero(talloc_autofree_context(), struct received_packet);
+ rp = talloc_zero(NULL, struct received_packet);
rp->opnum = opnum;
rp->r = talloc_reference(rp, r);
const char *printername = NULL;
struct spoolss_NotifyInfo *info = NULL;
- received_packets = NULL;
+ free_received_packets();
/* Start DCE/RPC server */
torture_assert(tctx, test_start_dcerpc_server(tctx, tctx->ev, &dce_ctx, &address), "");
#endif
/* Shut down DCE/RPC server */
talloc_free(dce_ctx);
+ free_received_packets();
return true;
}