[igt-dev] [PATCH i-g-t 1/2] runner: Plug more fd leaks

Petri Latvala petri.latvala at intel.com
Tue Oct 2 07:45:41 UTC 2018


Signed-off-by: Petri Latvala <petri.latvala at intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
---
 runner/resultgen.c    | 4 ++++
 runner/runner_tests.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/runner/resultgen.c b/runner/resultgen.c
index e8a60083..4e6528b8 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -809,6 +809,7 @@ static void fill_from_journal(int fd,
 	}
 
 	free(line);
+	fclose(f);
 }
 
 static void override_result_single(struct json_object *obj)
@@ -1058,13 +1059,16 @@ bool generate_results(int dirfd)
 		}
 
 		if (!parse_test_directory(testdirfd, &job_list.entries[i], &settings, &results)) {
+			close(testdirfd);
 			close(resultsfd);
 			return false;
 		}
+		close(testdirfd);
 	}
 
 	json_string = json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PRETTY);
 	write(resultsfd, json_string, strlen(json_string));
+	close(resultsfd);
 	return true;
 }
 
diff --git a/runner/runner_tests.c b/runner/runner_tests.c
index b03f2acf..3705d711 100644
--- a/runner/runner_tests.c
+++ b/runner/runner_tests.c
@@ -50,6 +50,8 @@ static char *dump_file(int dirfd, char *name)
 	}
 
 	s = read(fd, buf, 255);
+	close(fd);
+
 	if (s < 0) {
 		free(buf);
 		return NULL;
-- 
2.18.0



More information about the igt-dev mailing list