Thank you Noriko and Simon for your careful reviews.
I modified the fix:
* create the subentry with 'cn' value 'repl keep alive <rid>'
* slapi_ch_free without cast
* do the keep alive entry with '(&(objectclass=ldapsubentry)(cn=%s
%d))', in previous fix I forgot '%d'
I modified the test case following the recommended modifications
https://fedorahosted.org/389/ticket/48266
https://fedorahosted.org/389/attachment/ticket/48266/0001-Ticket-48266-3-...
https://fedorahosted.org/389/attachment/ticket/48266/0001-Ticket-48266-2-...