checkpolicy: use calloc() so no need to do memset() afterwards
PATCH 1/1 checkpolicy: use calloc() so no need to do memset() afterwards
Signed-off-by Kalevi Kolttonen <[email protected]>
--- checkpolicy/checkpolicy.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
checkpolicy/checkpolicy.c +1 -3
@@ -235,13 +235,11 @@ static int identify_equiv_types(void)* Create a list of access vector rules for each type * from the access vector table. */ - type_rules =malloc (sizeof (struct avtab_node ) * policydb.p_types.nprim); + type_rules =calloc (sizeof (struct avtab_node ) * policydb.p_types.nprim);if (!type_rules) {fprintf (stderr,"out of memory\n" );exit (1 ); } -memset (type_rules,0 , -sizeof (struct avtab_node ) * policydb.p_types.nprim);if (avtab_map (&policydb.te_avtab, create_type_rules, type_rules))exit (1 );
Signature · 1 line
2.54.0
checkpolicy/checkpolicy.c static int identify_equiv_types(void) · line 238
Quoted 2 lines · Kalevi Kolttonen
checkpolicy/checkpolicy.c +1
-1- type_rules =malloc (sizeof (struct avtab_node ) * policydb.p_types.nprim); + type_rules =calloc (sizeof (struct avtab_node ) * policydb.p_types.nprim);
Please ignore this trash and my other message too. I did not remember that calloc()'s signature differs from malloc()'s.
I just sent v2 combining these two patches into one, with the correct calloc() signature.
br,
KK