diff --git a/CHANGES b/CHANGES index 37dbc844..472e63d9 100644 --- a/CHANGES +++ b/CHANGES @@ -31,7 +31,7 @@ SVN HEAD Add w83793 support Log the error code on failure Add lm87 support - Program sensors: Fix a memory leak on error (with -u) + Program sensors: Fix a memory leaks on error Add sch311x support Hide error on missing dme1737 fan and pwm Add thmc50/adm1022 support diff --git a/prog/sensors/main.c b/prog/sensors/main.c index b1a7daa5..e3031ab7 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -229,16 +229,18 @@ int main (int argc, char *argv[]) } open_config_file(config_file_name); - if ((res = sensors_init(config_file))) { + res = sensors_init(config_file); + close_config_file(config_file_name); + if (res) { fprintf(stderr,"%s\n",sensors_strerror(res)); if (res == -SENSORS_ERR_PROC) fprintf(stderr, "Kernel interface access error\n" "For 2.6 kernels, make sure you have mounted sysfs and libsensors\n" "was compiled with sysfs support!\n"); + sensors_cleanup(); exit(1); } - close_config_file(config_file_name); /* build the degrees string */ set_degstr();