json_load_file: Initialize the error struct properly

Failing to do this has the effect that the error message is not
returned when the input file cannot be opened (e.g. if it doesn't
exist).

Thanks to Martin Vopatek for reporting.
This commit is contained in:
Petri Lehtinen
2009-10-27 17:46:57 +02:00
parent 15d992cb6a
commit f243930b68
4 changed files with 29 additions and 1 deletions

View File

@@ -864,6 +864,8 @@ json_t *json_load_file(const char *path, json_error_t *error)
json_t *result;
FILE *fp;
error_init(error);
fp = fopen(path, "r");
if(!fp)
{