CID 182717 call fclose, always

This commit is contained in:
Enno Rehling 2018-02-08 08:33:27 +01:00
parent 4f63cf12b2
commit 87081a37bc

View file

@ -932,6 +932,7 @@ static int include_json(const char *uri) {
FILE *F; FILE *F;
char name[PATH_MAX]; char name[PATH_MAX];
const char *filename = uri_to_file(uri, name, sizeof(name)); const char *filename = uri_to_file(uri, name, sizeof(name));
int result = -1;
F = fopen(filename, "r"); F = fopen(filename, "r");
if (F) { if (F) {
@ -952,15 +953,16 @@ static int include_json(const char *uri) {
if (config) { if (config) {
json_config(config); json_config(config);
cJSON_Delete(config); cJSON_Delete(config);
result = 0;
} }
else { else {
log_error("could not parse JSON from %s", uri); log_error("could not parse JSON from %s", uri);
return -1; result = -1;
} }
} }
fclose(F); fclose(F);
} }
return 0; return result;
} }
static int include_xml(const char *uri) { static int include_xml(const char *uri) {