diff mbox

[1/3] libsepol/tests: read_binary_policy() does not use f.handle

Message ID 20180609193031.2728-1-nicolas.iooss@m4x.org (mailing list archive)
State Not Applicable
Headers show

Commit Message

Nicolas Iooss June 9, 2018, 7:30 p.m. UTC
f.handle is never set in read_binary_policy() so there is no need to
call sepol_handle_destroy() on it. Moreover clang's static analyzer
warns about an uninitialized argument value in the first call.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
---
 libsepol/tests/test-downgrade.c | 2 --
 1 file changed, 2 deletions(-)
diff mbox

Patch

diff --git a/libsepol/tests/test-downgrade.c b/libsepol/tests/test-downgrade.c
index 1ee7ff4c7e7f..50807c1dd6ea 100644
--- a/libsepol/tests/test-downgrade.c
+++ b/libsepol/tests/test-downgrade.c
@@ -210,7 +210,6 @@  int read_binary_policy(const char *path, policydb_t *p)
 	if ((in_fp = fopen(path, "rb")) == NULL) {
 		fprintf(stderr, "Unable to open %s: %s\n", path,
 			strerror(errno));
-		sepol_handle_destroy(f.handle);
 		return -1;
 	}
 
@@ -220,7 +219,6 @@  int read_binary_policy(const char *path, policydb_t *p)
 	f.fp = in_fp;
 	rc = policydb_read(p, &f, 0);
 
-	sepol_handle_destroy(f.handle);
 	fclose(in_fp);
 	return rc;
 }