From a75821c66835c9392626a2af3b51840eabb9e4ba Mon Sep 17 00:00:00 2001 From: octo Date: Sat, 10 Jun 2006 13:57:55 +0000 Subject: [PATCH] trunk: fix some fd-leaks Thanks to Olaf Rempel for this patch. --- src/cpufreq.c | 1 + src/hddtemp.c | 2 ++ src/load.c | 1 + 3 files changed, 4 insertions(+) diff --git a/src/cpufreq.c b/src/cpufreq.c index b26c35e1..ba0149ad 100644 --- a/src/cpufreq.c +++ b/src/cpufreq.c @@ -123,6 +123,7 @@ static void cpufreq_read (void) if (fgets (buffer, 16, fp) == NULL) { syslog (LOG_WARNING, "cpufreq: fgets: %s", strerror (errno)); + fclose (fp); return; } diff --git a/src/hddtemp.c b/src/hddtemp.c index 08bbbc02..80b3419b 100644 --- a/src/hddtemp.c +++ b/src/hddtemp.c @@ -185,6 +185,7 @@ static int hddtemp_query_daemon (char *buffer, int buffer_size) syslog (LOG_ERR, "hddtemp: Error reading from socket: %s", strerror (errno)); + close (fd); return (-1); } buffer_fill += status; @@ -373,6 +374,7 @@ static void hddtemp_init (void) first_hddname = entry; } } + fclose (fh); } else DBG ("Could not open /proc/partitions: %s", diff --git a/src/load.c b/src/load.c index 4d43dd45..019f952c 100644 --- a/src/load.c +++ b/src/load.c @@ -107,6 +107,7 @@ static void load_read (void) if (fgets (buffer, 16, loadavg) == NULL) { syslog (LOG_WARNING, "load: fgets: %s", strerror (errno)); + fclose (loadavg); return; } -- 2.30.2