summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Greg Kaiser <gkaiser@google.com> 2019-01-11 06:28:49 -0800
committer Greg Kaiser <gkaiser@google.com> 2019-01-11 06:28:49 -0800
commit78438e2f7798925da65fbbb75a0fd789a4b3215c (patch)
tree67e5046a487fb39c670e089d3e7a3574d8ecd2cc
parent4a60ab2c6caac1c1d52a0a9189d4f6f36cd78a00 (diff)
libdexfile: Fix inconsequential resource leak in test
We make sure to close 'output_fd' in an error case. This is inconsequential since the test terminates almost immediately after this. But fixing this helps static analysis find other leaks in our code. Test: TreeHugger Change-Id: Id3392c366d575dc93f3e1ad802e436b44dda0870
-rw-r--r--libdexfile/external/dex_file_ext_c_test.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libdexfile/external/dex_file_ext_c_test.c b/libdexfile/external/dex_file_ext_c_test.c
index ad0737a292..85cd46e442 100644
--- a/libdexfile/external/dex_file_ext_c_test.c
+++ b/libdexfile/external/dex_file_ext_c_test.c
@@ -36,6 +36,7 @@ static int write_gtest_output_xml(char* gtest_output_path) {
}
if (fprintf(output_fd, gtest_output_xml) != sizeof(gtest_output_xml) - 1) {
fprintf(stderr, "Failed to write %s: %s\n", gtest_output_path, strerror(errno));
+ fclose(output_fd);
return 1;
}
if (fclose(output_fd) != 0) {