fixed memory leaks in librime.