avutil/atomic: reuse ret to avoid dereferencing twice the same value.

This commit is contained in:
Clément Bœsch 2014-05-26 21:08:32 +02:00
parent cc91488588
commit 56e432b27b

View File

@ -64,7 +64,7 @@ void *avpriv_atomic_ptr_cas(void * volatile *ptr, void *oldval, void *newval)
void *ret;
pthread_mutex_lock(&atomic_lock);
ret = *ptr;
if (*ptr == oldval)
if (ret == oldval)
*ptr = newval;
pthread_mutex_unlock(&atomic_lock);
return ret;