Directory Server makes a copy of the oid string.
The contents of the ber parameter are consumed by this function. Because of this, the caller should not free the BerElement once a successful call has been made to slapi_build_control().
The LDAPControl pointer that is returned in ctrlp should be freed by calling ldap_control_free(3LDAP), which is an LDAP API function.