libselinux: Fix ordering of arguments to calloc
PATCH 1/1 libselinux: Fix ordering of arguments to calloc
The number of elements should be first and the size of the elements second.
Signed-off-by James Carter <[email protected]>
--- libselinux/src/audit2why.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
libselinux/src/audit2why.c +2 -2
@@ -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);
Signature · 1 line
2.43.0
Quoted 5 lines · James Carter
The number of elements should be first and the size of the elements second.
Signed-off-by James Carter <[email protected]>
This patch has been merged.
Jim
Quoted 29 lines
--- libselinux/src/audit2why.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)libselinux/src/audit2why.c +2
-3@@ -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