Skip to content

Commit 8f941bf

Browse files
Use atomic_dec instead of refcount_dec in unit test
refcount_dec can cause a crash if the count becomes zero.
1 parent 19f5dec commit 8f941bf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

test/unit_homa_peer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ TEST_F(homa_peer, homa_peer_get__race_with_homa_peer_release)
555555
* will fail in homa_peer_get, and arrange for gc to remove the peer
556556
* when homa_peer_get acquires the spinlock.
557557
*/
558-
refcount_dec(&peer->refs);
558+
atomic_dec(&peer->refs.refs);
559559
unit_hook_register(gc_hook);
560560
hook_peer = peer;
561561
hook_peertab = self->homa.peertab;

0 commit comments

Comments
 (0)