fix readFile for stdin stream
fix realloc invalid pointer error
Remove unnecessary malloc and ensure buf passed to readFile is NULL
Merge branch 'f-kubotar-stream-read'. Fixes #3