intel_rdt: close file descriptor on error
authorAleksinski, MichalX <michalx.aleksinski@intel.com>
Fri, 26 Oct 2018 01:02:09 +0000 (02:02 +0100)
committerAleksinski, MichalX <michalx.aleksinski@intel.com>
Wed, 6 Mar 2019 07:04:16 +0000 (07:04 +0000)
Change-Id: I161c8df1e6a4c4c4e0dd4e20601323ef7a1c18f5

src/utils_proc_pids.c

index 9b07e42..1a05fe4 100644 (file)
@@ -191,8 +191,10 @@ int fetch_pids_for_procs(const char *procfs_path,
 
   int init_result = initialize_proc_pids(
       procs_names_array, procs_names_array_size, proc_pids_array);
-  if (0 != init_result)
+  if (0 != init_result) {
+    closedir(proc_dir);
     return -1;
+  }
 
   /* Go through procfs and find PIDS and their comms */
   struct dirent *entry;