Skip to contentSkip to conversation

checkpolicy: use calloc() so no need to do memset() afterwards

PATCH Superseded Kalevi Kolttonen 1 participant 1 message May 1 SELinux security module

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpolicy: use calloc() so no need to do memset() afterwards

---
 checkpolicy/module_compiler.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
checkpolicy/module_compiler.c +1 -2
index 4b2f98d8..c36773cb 100644
@@ -842,12 +842,11 @@ int require_class(int pass)
 				return -1;
 			}
 			allocated = 1;
-			if ((perm = malloc(sizeof(*perm))) == NULL) {
+			if ((perm = calloc(sizeof(*perm))) == NULL) {
 				yyerror("Out of memory!");
 				free(perm_id);
 				return -1;
 			}
-			memset(perm, 0, sizeof(*perm));
 			ret =
 			    hashtab_insert(datum->permissions.table, perm_id,
 					   perm);
Signature · 1 line
2.54.0