mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-11 17:30:00 +01:00
avutil/atomic: reuse ret to avoid dereferencing twice the same value.
This commit is contained in:
@@ -64,7 +64,7 @@ void *avpriv_atomic_ptr_cas(void * volatile *ptr, void *oldval, void *newval)
|
|||||||
void *ret;
|
void *ret;
|
||||||
pthread_mutex_lock(&atomic_lock);
|
pthread_mutex_lock(&atomic_lock);
|
||||||
ret = *ptr;
|
ret = *ptr;
|
||||||
if (*ptr == oldval)
|
if (ret == oldval)
|
||||||
*ptr = newval;
|
*ptr = newval;
|
||||||
pthread_mutex_unlock(&atomic_lock);
|
pthread_mutex_unlock(&atomic_lock);
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user