gallium/hud: close a previously opened handle
authorSteven Toth <stoth@kernellabs.com>
Mon, 24 Oct 2016 14:10:50 +0000 (10:10 -0400)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 7 Nov 2016 17:31:52 +0000 (18:31 +0100)
We're missing the closedir() to the matching opendir().

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/auxiliary/hud/hud_cpufreq.c
src/gallium/auxiliary/hud/hud_diskstat.c
src/gallium/auxiliary/hud/hud_nic.c

index bfc748b47f9e8256b1120416e0c613a03bea818b..e66c3e4a9e41a98ce2a0eef4c5eb20c4f1e3bd4f 100644 (file)
@@ -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) {
index 7d4f5001a3de425c9098a2c3316a6d1fdd155494..d4306cdd95c151e5e2b56cc82757c237370cff94 100644 (file)
@@ -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) {
index 719dd04a5819e7dab131954cb0502fa8e5f807e6..2795c9333694fdedf863e5bf0c7bd574aae11dd0 100644 (file)
@@ -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];