avutil/atomic: reuse ret to avoid dereferencing twice the same value.
authorClément Bœsch <u@pkh.me>
Mon, 26 May 2014 19:08:32 +0000 (21:08 +0200)
committerClément Bœsch <u@pkh.me>
Sat, 27 Dec 2014 21:14:23 +0000 (22:14 +0100)
libavutil/atomic.c

index 1fa6308..b13725d 100644 (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;