Skip to content

Commit

Permalink
Add missing ddsrt_mutex_lock in gcreq_queue_step
Browse files Browse the repository at this point in the history
This fixes unlocked access and unlocking a non-locked mutex when the current head of the
GC queue is to be postponed.

Note that the "step" function is currently only used in a fuzzer and that this case cannot
occur in a single-threaded processes.

Signed-off-by: Erik Boasson <[email protected]>
  • Loading branch information
eboasson committed May 14, 2024
1 parent 24c9938 commit 2caad2d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/ddsi/src/ddsi_gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ bool ddsi_gcreq_queue_step (struct ddsi_gcreq_queue *q)
{
/* Give up immediately instead of waiting: this exists to make less-threaded
(test/fuzzing) code possible. (I don't think this case can occur in a single
threaded process, but it might if a some threads exist.) */
threaded process, but it might if some threads exist.) */
ddsrt_mutex_lock (&q->lock);
break;
}
else
Expand Down

0 comments on commit 2caad2d

Please sign in to comment.