Fixed variable initialization bugs

Fixed a sporadic crash and a compilation warning.

`char type = NULL` is assigning a null pointer constant to a char, which compiles (sometimes with a warning) but is almost certainly not what you want. See http://c-faq.com/null/nullor0.html.

`getline` requires `*lineptr = NULL` and `n = 0` to trigger space allocation for `lineptr`. Omitting this initialization will sometimes prevent `getline` from calling `malloc` (depending on whatever happens to be in memory where `*n` is pointing), which makes `free()` below invalid. See http://man7.org/linux/man-pages/man3/getline.3.html and http://fxr.watson.org/fxr/source/libio/iogetdelim.c?v=GLIBC27;im=3#L65.