[PATCH] libselinux: Fix ordering of arguments to calloc

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

 



The number of elements should be first and the size of the elements
second.

Signed-off-by: James Carter <jwcart2@xxxxxxxxx>
---
 libselinux/src/audit2why.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libselinux/src/audit2why.c b/libselinux/src/audit2why.c
index 8c4c07d5..ad846cc3 100644
--- a/libselinux/src/audit2why.c
+++ b/libselinux/src/audit2why.c
@@ -148,7 +148,7 @@ static int check_booleans(struct boolean_t **bools)
 		sepol_bool_free(boolean);
 
 	if (fcnt > 0) {
-		*bools = calloc(sizeof(struct boolean_t), fcnt + 1);
+		*bools = calloc(fcnt + 1, sizeof(struct boolean_t));
 		if (!*bools) {
 			PyErr_SetString( PyExc_MemoryError, "Out of memory\n");
 			free(foundlist);
@@ -226,7 +226,7 @@ static int __policy_init(const char *init_path)
 		return 1;
 	}
 
-	avc = calloc(sizeof(struct avc_t), 1);
+	avc = calloc(1, sizeof(struct avc_t));
 	if (!avc) {
 		PyErr_SetString( PyExc_MemoryError, "Out of memory\n");
 		fclose(fp);
-- 
2.43.0





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

  Powered by Linux