From 5a58323064b32442e2de23c95642bc421be696f8 Mon Sep 17 00:00:00 2001 From: Steven Toth Date: Mon, 24 Oct 2016 10:10:50 -0400 Subject: gallium/hud: close a previously opened handle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We're missing the closedir() to the matching opendir(). Signed-off-by: Steven Toth Reviewed-by: Brian Paul Reviewed-by: Nicolai Hähnle --- src/gallium/auxiliary/hud/hud_cpufreq.c | 1 + src/gallium/auxiliary/hud/hud_diskstat.c | 5 ++++- src/gallium/auxiliary/hud/hud_nic.c | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/gallium/auxiliary/hud') diff --git a/src/gallium/auxiliary/hud/hud_cpufreq.c b/src/gallium/auxiliary/hud/hud_cpufreq.c index bfc748b47f9..e66c3e4a9e4 100644 --- a/src/gallium/auxiliary/hud/hud_cpufreq.c +++ b/src/gallium/auxiliary/hud/hud_cpufreq.c @@ -225,6 +225,7 @@ hud_get_num_cpufreq(bool displayhelp) snprintf(fn, sizeof(fn), "%s/cpufreq/scaling_max_freq", basename); add_object(dp->d_name, fn, CPUFREQ_MAXIMUM, cpu_index); } + closedir(dir); if (displayhelp) { list_for_each_entry(struct cpufreq_info, cfi, &gcpufreq_list, list) { diff --git a/src/gallium/auxiliary/hud/hud_diskstat.c b/src/gallium/auxiliary/hud/hud_diskstat.c index 7d4f5001a3d..d4306cdd95c 100644 --- a/src/gallium/auxiliary/hud/hud_diskstat.c +++ b/src/gallium/auxiliary/hud/hud_diskstat.c @@ -277,8 +277,10 @@ hud_get_num_disks(bool displayhelp) /* Add any partitions */ struct dirent *dpart; DIR *pdir = opendir(basename); - if (!pdir) + if (!pdir) { + closedir(dir); return 0; + } while ((dpart = readdir(pdir)) != NULL) { /* Avoid 'lo' and '..' and '.' */ @@ -298,6 +300,7 @@ hud_get_num_disks(bool displayhelp) add_object_part(basename, dpart->d_name, DISKSTAT_WR); } } + closedir(dir); if (displayhelp) { list_for_each_entry(struct diskstat_info, dsi, &gdiskstat_list, list) { diff --git a/src/gallium/auxiliary/hud/hud_nic.c b/src/gallium/auxiliary/hud/hud_nic.c index 719dd04a581..2795c933369 100644 --- a/src/gallium/auxiliary/hud/hud_nic.c +++ b/src/gallium/auxiliary/hud/hud_nic.c @@ -399,6 +399,7 @@ hud_get_num_nics(bool displayhelp) } } + closedir(dir); list_for_each_entry(struct nic_info, nic, &gnic_list, list) { char line[64]; -- cgit v1.2.3