[TSAN] Rework assertions to always access refcount atomically
`-fsanitize=address` complained that the `refcount > 0` assertions were reading without atomics. We can fix this by reworking them to read the previous value. Closes: #582 Approved by: jlebon
This commit is contained in:
1 parent
f0519e541f
commit
c1c70bceb7
3 files changed
+11
-14
No files matched your search
@@ -161,11 +161,10 @@ ost_remote_new_from_keyfile (GKeyFile *keyfile,
|
||||
static OstreeRemote *
|
||||
ost_remote_ref (OstreeRemote *remote)
|
||||
{
|
||||
gint refcount;
|
||||
g_return_val_if_fail (remote != NULL, NULL);
|
||||
g_return_val_if_fail (remote->ref_count > 0, NULL);
|
||||
|
||||
g_atomic_int_inc (&remote->ref_count);
|
||||
|
||||
refcount = g_atomic_int_add (&remote->ref_count, 1);
|
||||
g_assert (refcount > 0);
|
||||
return remote;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user