libsepol/tests: fix use of unitialized variable
When write_binary_policy() fails to open the binary policy, it calls
sepol_handle_destroy(f.handle) but structure f has not been initialized
at this point. Use variable handle instead.
This issue has been found using clang's static analyzer.
Signed-off-by: Nicolas Iooss <[email protected]>
diff --git a/libsepol/tests/test-downgrade.c b/libsepol/tests/test-downgrade.c
index 50807c1..963f3fa 100644
--- a/libsepol/tests/test-downgrade.c
+++ b/libsepol/tests/test-downgrade.c
@@ -254,7 +254,7 @@
if ((out_fp = fopen(path, "w" )) == NULL) {
fprintf(stderr, "Unable to open %s: %s\n", path,
strerror(errno));
- sepol_handle_destroy(f.handle);
+ sepol_handle_destroy(handle);
return -1;
}