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
diff --git a/libdexfile/external/dex_file_ext_c_test.c b/libdexfile/external/dex_file_ext_c_test.c
index ad0737a..85cd46e 100644
--- a/libdexfile/external/dex_file_ext_c_test.c
+++ b/libdexfile/external/dex_file_ext_c_test.c
@@ -36,6 +36,7 @@
}
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) {