Prevent readline-history memleak.
Fix memleaks.