Memory management improvement

Allocate the memory to read a file into the buffer only after the file
has actually been opened successfully. Previously, the buffer was
grown before the file was open, so if it failed, the buffer was
remained enlarged.
Adds a new QA test function to cover chula_buffer_read_file().