Skip to content

Commit

Permalink
avutil/atomic: reuse ret to avoid dereferencing twice the same value.
Browse files Browse the repository at this point in the history
  • Loading branch information
ubitux committed Dec 27, 2014
1 parent cc91488 commit 56e432b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libavutil/atomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 56e432b

Please sign in to comment.