Skip to content

Commit

Permalink
info: fix off-by-1 check of refcount
Browse files Browse the repository at this point in the history
The yaksu_atomic_decr returns the value before decrement.

Signed-off-by: Hui Zhou <[email protected]>
  • Loading branch information
hzhou committed Jan 15, 2021
1 parent 32aa7e7 commit aafca77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/frontend/info/yaksa_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int yaksa_info_free(yaksa_info_t info)
int rc = YAKSA_SUCCESS;
yaksi_info_s *yaksi_info = (yaksi_info_s *) info;

if (yaksu_atomic_decr(&yaksi_info->refcount) > 0)
if (yaksu_atomic_decr(&yaksi_info->refcount) > 1)
goto fn_exit;

rc = yaksur_info_free_hook(yaksi_info);
Expand Down

0 comments on commit aafca77

Please sign in to comment.