Use calloc for consistency with other functions
Added test_write_path_to_stream