Fix memory leak in `echo_in'.

It is not necessary to call malloc there as strdup already allocates the
necessary memory.  Also sizeof(curline) gives you the size of a pointer
to a string, not the size of the string (cf. strlen).
Remove unnecessary `extern's.
Introduce xmalloc and xrealloc.

It's a pretty standard convention in C-land.