Skip to contentSkip to conversation

checkpolicy - self leak

PATCH New Joshua Brindle 1 participant 1 message Oct 4, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpolicy - self leak

These patches fix leaks when self is the identifier, both when declared (in an error condition) and when used in an avrule.

module_compiler.c +1 -0
diff -pur -x .svn checkpolicy/module_compiler.c checkpolicy/module_compiler.c
@@ -264,6 +262,7 @@ type_datum_t *declare_type(unsigned char
 	}
         if (strcmp(id, "self") == 0) {
                 yyerror("'self' is a reserved type name and may not be declared.");
+                free(id);
                 return NULL;
         }
 
policy_parse.y +1 -0
diff -pur -x .svn checkpolicy/policy_parse.y checkpolicy/policy_parse.y
@@ -2253,6 +2255,7 @@ static int define_te_avtab_helper(int wh
         add = 1;
 	while ((id = queue_remove(id_queue))) {
 		if (strcmp(id, "self") == 0) {
+			free(id);
 			avrule->flags |= RULE_SELF;
 			continue;
 		}