Fix memory leak in scanner when using flex 2.5.9 or later.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5637 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2009-02-08 12:00:24 +00:00
1 parent 09abbcb686
commit 556b03e425
2 files changed
+11

No files matched your search

+1
View File
@@ -8,6 +8,7 @@ SVN-HEAD
Detect excessive recursion depth during expression eval (#2365)
Return a string rather than NULL for unknown errors
Skip non-file sysfs entries for speed
Fix memory leak in scanner when using flex 2.5.9 or later
lm_sensors.init: Support new format of /etc/sysconfig/lm_sensors (#2246)
Drop support for kernels 2.4 and earlier
lm_sensors.init.suse: Delete (actual SuSE script is much different)
+10
View File
@@ -350,5 +350,15 @@ void sensors_scanner_exit(void)
{
sensors_yy_delete_buffer(scan_buf);
scan_buf = (YY_BUFFER_STATE)0;
/* As of flex 2.5.9, yylex_destroy() must be called when done with the
scaller, otherwise we'll leak memory. */
#if defined(YY_FLEX_MAJOR_VERSION) && defined(YY_FLEX_MINOR_VERSION) && defined(YY_FLEX_SUBMINOR_VERSION)
#if YY_FLEX_MAJOR_VERSION > 2 || \
(YY_FLEX_MAJOR_VERSION == 2 && (YY_FLEX_MINOR_VERSION > 5 || \
(YY_FLEX_MINOR_VERSION == 5 && YY_FLEX_SUBMINOR_VERSION >= 9)))
sensors_yylex_destroy();
#endif
#endif
}