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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 libsepol/tests/test-downgrade.c | 2 --
 1 file changed, 2 deletions(-)

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;
 }
-- 
2.17.1


_______________________________________________
Selinux mailing list
Selinux@xxxxxxxxxxxxx
To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx.
To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux