diff options
author | Mark M. Hoffman <mhoffman@lightlink.com> | 2006-05-20 15:24:37 +0000 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2006-05-20 15:24:37 +0000 |
commit | 4d2c4fd2122716f0a0add1861043e91a72b9f938 (patch) | |
tree | ec50bc6accd052ee306822e3b67d8d9a42b82f66 /lib/init.c | |
parent | 54423af70de9f30d0976c6c74d750a1c772be478 (diff) | |
download | lm-sensors-git-4d2c4fd2122716f0a0add1861043e91a72b9f938.tar.gz |
Previous leak fix caused multiple sensors_init() calls to break.
This patch fixes that by managing the scanner buffers manually.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3300 7894878c-1315-0410-8ee3-d5d059ff63e0
Diffstat (limited to 'lib/init.c')
-rw-r--r-- | lib/init.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -26,6 +26,7 @@ #include "access.h" #include "conf.h" #include "sysfs.h" +#include "scanner.h" static void free_proc_chips_entry(sensors_proc_chips_entry entry); static void free_chip_name(sensors_chip_name name); @@ -48,7 +49,8 @@ int sensors_init(FILE *input) if ((res = sensors_read_proc_chips()) || (res = sensors_read_proc_bus())) return res; } - sensors_yyin = input; + if ((res = sensors_scanner_init(input))) + return -SENSORS_ERR_PARSE; if ((res = sensors_yyparse())) return -SENSORS_ERR_PARSE; if ((res = sensors_substitute_busses())); @@ -60,6 +62,8 @@ void sensors_cleanup(void) { int i; + sensors_scanner_exit(); + for (i = 0; i < sensors_proc_chips_count; i++) free_proc_chips_entry(sensors_proc_chips[i]); free(sensors_proc_chips); |