fix(core): Clear staged async queue links

TAILQ_REMOVE leaves intrusive link fields unchanged in release builds. Clear both links before invoking cancellation callbacks so stack-local staging queue addresses cannot escape through retained operations.
This commit is contained in:
Julius Pfrommer
2026-08-30 17:49:52 +02:00
committed by Julius Pfrommer
parent f9eb7a4a2a
commit 437995bc22
+8
View File
@@ -424,6 +424,10 @@ UA_AsyncManager_cancelSession(UA_Server *server, const UA_NodeId *sessionId,
while((op = TAILQ_FIRST(&canceledOps))) {
TAILQ_REMOVE(&canceledOps, op, pointers);
/* TAILQ_REMOVE does not clear the links in release builds. Avoid
* retaining the stack-local queue head across the callback. */
op->pointers.tqe_next = NULL;
op->pointers.tqe_prev = NULL;
UA_AsyncOperation_cancel(server, op, status);
}
@@ -575,6 +579,10 @@ cancelAsyncResponseOperations(UA_Server *server, UA_AsyncResponse *ar,
* cancellation callback may reenter and mutate the waiting queue. */
while((op = TAILQ_FIRST(&canceledOps))) {
TAILQ_REMOVE(&canceledOps, op, pointers);
/* TAILQ_REMOVE does not clear the links in release builds. Avoid
* retaining the stack-local queue head across the callback. */
op->pointers.tqe_next = NULL;
op->pointers.tqe_prev = NULL;
UA_AsyncOperation_cancel(server, op, status);
}
}