You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BUG#35998554: get_group_member_info_*() does not distinguish member not found from error
It was discovered that some methods from `Group_member_info_manager`
class did return the same value for distinct situations, which could
be masquerading errors.
One case is
```
Group_member_info *
Group_member_info_manager::get_group_member_info_by_member_id(
const Gcs_member_identifier &id);
```
that does return a allocated copy of the `member_info` when the
member exists on the `Group_member_info_manager`, or returns
`nullprt` when the member does not exist.
Though `nullptr` can also be returned when the memory allocation of
the copy fails, which means that the method caller is unable to
distinguish:
* member not found;
* no memory available to construct the object.
On both situations the method caller will interpret `nullptr` as
member not found which can leverage incorrect decisions.
The same pattern exists on the methods:
* Group_member_info_manager::get_group_member_info()
* Group_member_info_manager::get_group_member_info_by_index()
* Group_member_info_manager::get_group_member_info_by_member_id()
* Group_member_info_manager::get_primary_member_info()
To solve the above issue, the four methods were refactored to:
1) return a boolean value to state if the member was found;
2) receive a out parameter that is a local reference to the method
caller that is updated when the member is found. The use of the
reference eliminates the allocation of the memory.
Change-Id: Ic10263943fc63f40cdda506a59f10962aa208d92
0 commit comments