[DF-5341] Fix memory leaks in BiDi methods