Issue 50506 - Replace slapi_entry_attr_get_charptr() with slapi_entry_attr_get_ref()
Description:
There has been a pattern/habit in the code of using slapi_entry_attr_get_charptr()
to get an attribute value, but this function strdup's the entry's attribute value.
In almost all cases the slapi_entry_attr_get_charptr() value is freed right away -
it is not consumed. This is causing unnecessary malloc/free's which adds to
fragmentation and hurts performance. Instead, if the attribute value is not consumed
we should use slapi_entry_attr_get_ref() instead, which just grabs a pointer to
the attribute value.
relates: https://pagure.io/389-ds-base/issue/50506
ASAN & covscan approved
Reviewed by: lkrispen(Thanks!)