Merge pull request #8 from sylvain-miermont/master

Warning when compiling with -O2
This commit is contained in:
Krzysztof Gabis 2013-10-10 10:35:18 -07:00
commit 713b563375

View File

@ -500,7 +500,7 @@ JSON_Value * json_parse_file(const char *filename) {
rewind(fp);
file_contents = (char*)parson_malloc(sizeof(char) * (file_size + 1));
if (!file_contents) { fclose(fp); return NULL; }
fread(file_contents, file_size, 1, fp);
if (fread(file_contents, file_size, 1, fp) < 1) { fclose(fp); return NULL; }
fclose(fp);
file_contents[file_size] = '\0';
output_value = json_parse_string(file_contents);