forked from github/server
CID 26263: Memory - illegal accesses (UNINIT)
This commit is contained in:
parent
5f4c31af1c
commit
db6e9444d6
1 changed files with 7 additions and 5 deletions
|
@ -66,22 +66,24 @@ int config_read(const char *filename, const char * relpath)
|
||||||
}
|
}
|
||||||
if (F) {
|
if (F) {
|
||||||
long size;
|
long size;
|
||||||
int result;
|
|
||||||
char *data;
|
|
||||||
|
|
||||||
fseek(F, 0, SEEK_END);
|
fseek(F, 0, SEEK_END);
|
||||||
size = ftell(F);
|
size = ftell(F);
|
||||||
rewind(F);
|
rewind(F);
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
|
int result;
|
||||||
|
char *data;
|
||||||
size_t sz = (size_t)size;
|
size_t sz = (size_t)size;
|
||||||
|
|
||||||
data = malloc(sz);
|
data = malloc(sz);
|
||||||
fread(data, 1, sz, F);
|
fread(data, 1, sz, F);
|
||||||
fclose(F);
|
fclose(F);
|
||||||
}
|
|
||||||
result = config_parse(data);
|
result = config_parse(data);
|
||||||
free(data);
|
free(data);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
fclose(F);
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue