CID 26263: Memory - illegal accesses (UNINIT)

This commit is contained in:
Enno Rehling 2015-10-29 16:25:52 +01:00
parent 5f4c31af1c
commit db6e9444d6
1 changed files with 7 additions and 5 deletions

View File

@ -66,22 +66,24 @@ int config_read(const char *filename, const char * relpath)
}
if (F) {
long size;
int result;
char *data;
fseek(F, 0, SEEK_END);
size = ftell(F);
rewind(F);
if (size > 0) {
int result;
char *data;
size_t sz = (size_t)size;
data = malloc(sz);
fread(data, 1, sz, F);
fclose(F);
}
result = config_parse(data);
free(data);
return result;
}
fclose(F);
}
return 1;
}