SharedBuffer: Fix bug in return value of release()
Since the equality operator '==' has higher precedence than the assignment operator '=', we were assigning 'prev' to the result of our comparison and not the result of mRefs.fetch_sub(). This means that 'prev' would only receive the values 0 or 1. In the cases where fetch_sub() returned 0 or 1, we were happening to get the correct value. But if fetch_sub() was greator than 1, we would return to the user 0, instead of the previous reference count. We fix this by properly adding parentheses. We also adjust the whitespace a little to hopefully make the groupings of the logic easier to see. Change-Id: Ib129798a7076854b9ca4f6385c42edbf4fb75e57
Loading
Please register or sign in to comment