Fix bug when calling readline with unallocated buffer