Ticket 47528 - 389-ds-base built with mozldap can crash from invalid free
Bug Description: The issue is that the slapi_escape_filter_value() returned string gets
freed by the caller. When using mozldap, this function can return the
original filter pointer, which can lead to a double free.
Fix Description: Return a copy of the filter str so it can be safely freed. Also free
the buf if it's not being returned.
https://fedorahosted.org/389/ticket/47528
Reviewed by: nhosoi(Thanks!)
(cherry picked from commit da59cff5e6d27c18bbb02cba98bb99c1bfa37c70)