933f01c077
of the cpuid module. - lm_sensors-r6016-handle-superio-wo-logdev.patch: Properly handle Super-I/O chips without logical device. - lm_sensors-r6017-fix-sysfs-detection.patch: libsensors: Change sysfs detection to survive upcoming kernel changes (bnc#751180). - lm_sensors-r6025-sensord-fix-memory-leaks.patch: sensord: Fix memory leaks revealed by valgrind (bnc#751177). - lm_sensors-r6030-fix-power-interval-output.patch: Fix power interval output. OBS-URL: https://build.opensuse.org/package/show/Base:System/sensors?expand=0&rev=46
71 lines
1.9 KiB
Diff
71 lines
1.9 KiB
Diff
References: bnc#751177
|
|
|
|
Fix memory leaks in sensord revealed by valgrind.
|
|
|
|
The leak in daemonize() is harmless, we're about to exit anyway. Fix
|
|
it still to make valgrind happy.
|
|
|
|
The leak in do_features() is real, as the function is called
|
|
periodically by the daemon, for all actions. If the intervals at set
|
|
low and the system has many sensors, the leak could be significant,
|
|
maybe 150 kB/day.
|
|
|
|
---
|
|
prog/sensord/sense.c | 22 +++++++++++++---------
|
|
prog/sensord/sensord.c | 6 +++++-
|
|
2 files changed, 18 insertions(+), 10 deletions(-)
|
|
|
|
--- lm_sensors-3.3.1.orig/prog/sensord/sense.c
|
|
+++ lm_sensors-3.3.1/prog/sensord/sense.c
|
|
@@ -132,14 +132,7 @@ static int do_features(const sensors_chi
|
|
const FeatureDescriptor *feature, int action)
|
|
{
|
|
char *label;
|
|
- int alrm, beep;
|
|
-
|
|
- label = sensors_get_label(chip, feature->feature);
|
|
- if (!label) {
|
|
- sensorLog(LOG_ERR, "Error getting sensor label: %s/%s",
|
|
- chip->prefix, feature->feature->name);
|
|
- return -1;
|
|
- }
|
|
+ int alrm, beep, ret;
|
|
|
|
alrm = get_flag(chip, feature->alarmNumber);
|
|
if (alrm == -1)
|
|
@@ -151,7 +144,18 @@ static int do_features(const sensors_chi
|
|
if (beep == -1)
|
|
return -1;
|
|
|
|
- return get_features(chip, feature, action, label, alrm, beep);
|
|
+ label = sensors_get_label(chip, feature->feature);
|
|
+ if (!label) {
|
|
+ sensorLog(LOG_ERR, "Error getting sensor label: %s/%s",
|
|
+ chip->prefix, feature->feature->name);
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
+ ret = get_features(chip, feature, action, label, alrm, beep);
|
|
+
|
|
+ free(label);
|
|
+
|
|
+ return ret;
|
|
}
|
|
|
|
static int doKnownChip(const sensors_chip_name *chip,
|
|
--- lm_sensors-3.3.1.orig/prog/sensord/sensord.c
|
|
+++ lm_sensors-3.3.1/prog/sensord/sensord.c
|
|
@@ -204,7 +204,11 @@ static void daemonize(void)
|
|
} else if (pid != 0) {
|
|
fprintf(file, "%d\n", pid);
|
|
fclose(file);
|
|
- unloadLib();
|
|
+
|
|
+ freeChips();
|
|
+ if (unloadLib())
|
|
+ exit(EXIT_FAILURE);
|
|
+
|
|
exit(EXIT_SUCCESS);
|
|
}
|
|
|