FIX: L:222: config may not be initialised. L:585 closed host_model_info so there is no possible resource leak.
This commit is contained in:
parent
6c06247953
commit
16aaf68b1f
1 changed files with 3 additions and 2 deletions
|
@ -208,7 +208,7 @@ void parse_config()
|
||||||
char homedir[512];
|
char homedir[512];
|
||||||
|
|
||||||
// opening and reading the config file
|
// opening and reading the config file
|
||||||
FILE *config;
|
FILE *config=NULL;
|
||||||
if (config_directory == NULL)
|
if (config_directory == NULL)
|
||||||
{
|
{
|
||||||
if (getenv("HOME") != NULL)
|
if (getenv("HOME") != NULL)
|
||||||
|
@ -218,7 +218,7 @@ void parse_config()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
config = fopen(config_directory, "r");
|
config = fopen(config_directory, "r");
|
||||||
if (config == NULL)
|
if (config == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -581,6 +581,7 @@ void get_info()
|
||||||
FILE *host_model_info = fopen("/sys/devices/virtual/dmi/id/board_name", "r");
|
FILE *host_model_info = fopen("/sys/devices/virtual/dmi/id/board_name", "r");
|
||||||
if (!host_model_info)
|
if (!host_model_info)
|
||||||
host_model_info = fopen("/sys/devices/virtual/dmi/id/product_name", "r");
|
host_model_info = fopen("/sys/devices/virtual/dmi/id/product_name", "r");
|
||||||
|
fclose(host_model_info);
|
||||||
#ifdef __FREEBSD__
|
#ifdef __FREEBSD__
|
||||||
host_model_info = popen("sysctl -a hw.hv_vendor", "r");
|
host_model_info = popen("sysctl -a hw.hv_vendor", "r");
|
||||||
while (fgets(line, sizeof(line), host_model_info))
|
while (fgets(line, sizeof(line), host_model_info))
|
||||||
|
|
Loading…
Reference in a new issue