|
|
c411eb |
diff --git libsepol-2.8/cil/src/cil_binary.c libsepol-2.8/cil/src/cil_binary.c
|
|
|
c411eb |
index 0cc6eeb..d1c7b14 100644
|
|
|
c411eb |
--- libsepol-2.8/cil/src/cil_binary.c
|
|
|
c411eb |
+++ libsepol-2.8/cil/src/cil_binary.c
|
|
|
c411eb |
@@ -912,6 +912,8 @@ int cil_sensalias_to_policydb(policydb_t *pdb, struct cil_alias *cil_alias)
|
|
|
c411eb |
key = cil_strdup(cil_alias->datum.fqn);
|
|
|
c411eb |
rc = symtab_insert(pdb, SYM_LEVELS, key, sepol_alias, SCOPE_DECL, 0, NULL);
|
|
|
c411eb |
if (rc != SEPOL_OK) {
|
|
|
c411eb |
+ if (rc == 1)
|
|
|
c411eb |
+ free(sepol_alias);
|
|
|
c411eb |
goto exit;
|
|
|
c411eb |
}
|
|
|
c411eb |
|
|
|
c411eb |
@@ -1763,11 +1765,13 @@ int __cil_avrulex_ioctl_to_hashtable(hashtab_t h, uint16_t kind, uint32_t src, u
|
|
|
c411eb |
hashtab_xperms = cil_malloc(sizeof(*hashtab_xperms));
|
|
|
c411eb |
rc = ebitmap_cpy(hashtab_xperms, xperms);
|
|
|
c411eb |
if (rc != SEPOL_OK) {
|
|
|
c411eb |
+ free(hashtab_xperms);
|
|
|
c411eb |
free(avtab_key);
|
|
|
c411eb |
goto exit;
|
|
|
c411eb |
}
|
|
|
c411eb |
rc = hashtab_insert(h, (hashtab_key_t)avtab_key, hashtab_xperms);
|
|
|
c411eb |
if (rc != SEPOL_OK) {
|
|
|
c411eb |
+ free(hashtab_xperms);
|
|
|
c411eb |
free(avtab_key);
|
|
|
c411eb |
goto exit;
|
|
|
c411eb |
}
|
|
|
c411eb |
@@ -2157,6 +2161,7 @@ static int __cil_cond_expr_to_sepol_expr_helper(policydb_t *pdb, struct cil_list
|
|
|
c411eb |
op->expr_type = COND_NEQ;
|
|
|
c411eb |
break;
|
|
|
c411eb |
default:
|
|
|
c411eb |
+ free(op);
|
|
|
c411eb |
goto exit;
|
|
|
c411eb |
}
|
|
|
c411eb |
|
|
|
c411eb |
@@ -2283,6 +2288,7 @@ int cil_booleanif_to_policydb(policydb_t *pdb, const struct cil_db *db, struct c
|
|
|
c411eb |
|
|
|
c411eb |
cond_expr_destroy(tmp_cond->expr);
|
|
|
c411eb |
free(tmp_cond);
|
|
|
c411eb |
+ tmp_cond = NULL;
|
|
|
c411eb |
|
|
|
c411eb |
for (cb_node = node->cl_head; cb_node != NULL; cb_node = cb_node->next) {
|
|
|
c411eb |
if (cb_node->flavor == CIL_CONDBLOCK) {
|
|
|
c411eb |
@@ -2327,6 +2333,11 @@ int cil_booleanif_to_policydb(policydb_t *pdb, const struct cil_db *db, struct c
|
|
|
c411eb |
return SEPOL_OK;
|
|
|
c411eb |
|
|
|
c411eb |
exit:
|
|
|
c411eb |
+ if (tmp_cond) {
|
|
|
c411eb |
+ if (tmp_cond->expr)
|
|
|
c411eb |
+ cond_expr_destroy(tmp_cond->expr);
|
|
|
c411eb |
+ free(tmp_cond);
|
|
|
c411eb |
+ }
|
|
|
c411eb |
return rc;
|
|
|
c411eb |
}
|
|
|
c411eb |
|
|
|
c411eb |
@@ -4797,6 +4808,8 @@ static struct cil_list *cil_classperms_from_sepol(policydb_t *pdb, uint16_t clas
|
|
|
c411eb |
return cp_list;
|
|
|
c411eb |
|
|
|
c411eb |
exit:
|
|
|
c411eb |
+ if (cp)
|
|
|
c411eb |
+ free(cp);
|
|
|
c411eb |
cil_log(CIL_ERR,"Failed to create CIL class-permissions from sepol values\n");
|
|
|
c411eb |
return NULL;
|
|
|
c411eb |
}
|
|
|
c411eb |
diff --git libsepol-2.8/cil/src/cil_resolve_ast.c libsepol-2.8/cil/src/cil_resolve_ast.c
|
|
|
c411eb |
index 0225924..3ea070c 100644
|
|
|
c411eb |
--- libsepol-2.8/cil/src/cil_resolve_ast.c
|
|
|
c411eb |
+++ libsepol-2.8/cil/src/cil_resolve_ast.c
|
|
|
c411eb |
@@ -1522,6 +1522,7 @@ int cil_resolve_sidorder(struct cil_tree_node *current, void *extra_args)
|
|
|
c411eb |
rc = cil_resolve_name(current, (char *)curr->data, CIL_SYM_SIDS, extra_args, &datum);
|
|
|
c411eb |
if (rc != SEPOL_OK) {
|
|
|
c411eb |
cil_log(CIL_ERR, "Failed to resolve sid %s in sidorder\n", (char *)curr->data);
|
|
|
c411eb |
+ free(new);
|
|
|
c411eb |
goto exit;
|
|
|
c411eb |
}
|
|
|
c411eb |
cil_list_append(new, CIL_SID, datum);
|
|
|
c411eb |
@@ -1591,6 +1592,8 @@ int cil_resolve_catorder(struct cil_tree_node *current, void *extra_args)
|
|
|
c411eb |
return SEPOL_OK;
|
|
|
c411eb |
|
|
|
c411eb |
exit:
|
|
|
c411eb |
+ if (new)
|
|
|
c411eb |
+ free(new);
|
|
|
c411eb |
return rc;
|
|
|
c411eb |
}
|
|
|
c411eb |
|
|
|
c411eb |
@@ -1624,6 +1627,7 @@ int cil_resolve_sensitivityorder(struct cil_tree_node *current, void *extra_args
|
|
|
c411eb |
return SEPOL_OK;
|
|
|
c411eb |
|
|
|
c411eb |
exit:
|
|
|
c411eb |
+ free(new);
|
|
|
c411eb |
return rc;
|
|
|
c411eb |
}
|
|
|
c411eb |
|
|
|
c411eb |
@@ -2853,6 +2857,7 @@ int cil_resolve_call1(struct cil_tree_node *current, void *extra_args)
|
|
|
c411eb |
rc = cil_fill_cats(pc, &catset->cats);
|
|
|
c411eb |
if (rc != SEPOL_OK) {
|
|
|
c411eb |
cil_destroy_catset(catset);
|
|
|
c411eb |
+ cil_destroy_args(new_arg);
|
|
|
c411eb |
goto exit;
|
|
|
c411eb |
}
|
|
|
c411eb |
cil_tree_node_init(&cat_node);
|
|
|
c411eb |
@@ -2877,6 +2882,7 @@ int cil_resolve_call1(struct cil_tree_node *current, void *extra_args)
|
|
|
c411eb |
if (rc != SEPOL_OK) {
|
|
|
c411eb |
cil_log(CIL_ERR, "Failed to create anonymous level, rc: %d\n", rc);
|
|
|
c411eb |
cil_destroy_level(level);
|
|
|
c411eb |
+ cil_destroy_args(new_arg);
|
|
|
c411eb |
goto exit;
|
|
|
c411eb |
}
|
|
|
c411eb |
cil_tree_node_init(&lvl_node);
|
|
|
c411eb |
@@ -2901,6 +2907,7 @@ int cil_resolve_call1(struct cil_tree_node *current, void *extra_args)
|
|
|
c411eb |
if (rc != SEPOL_OK) {
|
|
|
c411eb |
cil_log(CIL_ERR, "Failed to create anonymous levelrange, rc: %d\n", rc);
|
|
|
c411eb |
cil_destroy_levelrange(range);
|
|
|
c411eb |
+ cil_destroy_args(new_arg);
|
|
|
c411eb |
goto exit;
|
|
|
c411eb |
}
|
|
|
c411eb |
cil_tree_node_init(&range_node);
|
|
|
c411eb |
@@ -2925,6 +2932,7 @@ int cil_resolve_call1(struct cil_tree_node *current, void *extra_args)
|
|
|
c411eb |
if (rc != SEPOL_OK) {
|
|
|
c411eb |
cil_log(CIL_ERR, "Failed to create anonymous ip address, rc; %d\n", rc);
|
|
|
c411eb |
cil_destroy_ipaddr(ipaddr);
|
|
|
c411eb |
+ cil_destroy_args(new_arg);
|
|
|
c411eb |
goto exit;
|
|
|
c411eb |
}
|
|
|
c411eb |
cil_tree_node_init(&addr_node);
|
|
|
c411eb |
@@ -2955,6 +2963,7 @@ int cil_resolve_call1(struct cil_tree_node *current, void *extra_args)
|
|
|
c411eb |
if (rc != SEPOL_OK) {
|
|
|
c411eb |
cil_log(CIL_ERR, "Failed to create anonymous classpermission\n");
|
|
|
c411eb |
cil_destroy_classpermission(cp);
|
|
|
c411eb |
+ cil_destroy_args(new_arg);
|
|
|
c411eb |
goto exit;
|
|
|
c411eb |
}
|
|
|
c411eb |
cil_tree_node_init(&cp_node);
|
|
|
c411eb |
@@ -2970,6 +2979,7 @@ int cil_resolve_call1(struct cil_tree_node *current, void *extra_args)
|
|
|
c411eb |
default:
|
|
|
c411eb |
cil_log(CIL_ERR, "Unexpected flavor: %d\n",
|
|
|
c411eb |
(((struct cil_param*)item->data)->flavor));
|
|
|
c411eb |
+ cil_destroy_args(new_arg);
|
|
|
c411eb |
rc = SEPOL_ERR;
|
|
|
c411eb |
goto exit;
|
|
|
c411eb |
}
|
|
|
c411eb |
diff --git libsepol-2.8/cil/src/cil_symtab.c libsepol-2.8/cil/src/cil_symtab.c
|
|
|
c411eb |
index 3769979..2970b86 100644
|
|
|
c411eb |
--- libsepol-2.8/cil/src/cil_symtab.c
|
|
|
c411eb |
+++ libsepol-2.8/cil/src/cil_symtab.c
|
|
|
c411eb |
@@ -185,6 +185,7 @@ int cil_complex_symtab_insert(struct cil_complex_symtab *symtab,
|
|
|
c411eb |
ckey->key2 == curr->ckey->key2 &&
|
|
|
c411eb |
ckey->key3 == curr->ckey->key3 &&
|
|
|
c411eb |
ckey->key4 == curr->ckey->key4) {
|
|
|
c411eb |
+ free(node);
|
|
|
c411eb |
return SEPOL_EEXIST;
|
|
|
c411eb |
}
|
|
|
c411eb |
|
|
|
c411eb |
diff --git libsepol-2.8/src/expand.c libsepol-2.8/src/expand.c
|
|
|
c411eb |
index 6f1b235..125a680 100644
|
|
|
c411eb |
--- libsepol-2.8/src/expand.c
|
|
|
c411eb |
+++ libsepol-2.8/src/expand.c
|
|
|
c411eb |
@@ -1451,6 +1451,7 @@ static int expand_filename_trans(expand_state_t *state, filename_trans_rule_t *r
|
|
|
c411eb |
new_trans->name = strdup(cur_rule->name);
|
|
|
c411eb |
if (!new_trans->name) {
|
|
|
c411eb |
ERR(state->handle, "Out of memory!");
|
|
|
c411eb |
+ free(new_trans);
|
|
|
c411eb |
return -1;
|
|
|
c411eb |
}
|
|
|
c411eb |
new_trans->stype = i + 1;
|
|
|
c411eb |
@@ -1460,6 +1461,8 @@ static int expand_filename_trans(expand_state_t *state, filename_trans_rule_t *r
|
|
|
c411eb |
otype = calloc(1, sizeof(*otype));
|
|
|
c411eb |
if (!otype) {
|
|
|
c411eb |
ERR(state->handle, "Out of memory!");
|
|
|
c411eb |
+ free(new_trans->name);
|
|
|
c411eb |
+ free(new_trans);
|
|
|
c411eb |
return -1;
|
|
|
c411eb |
}
|
|
|
c411eb |
otype->otype = mapped_otype;
|
|
|
c411eb |
diff --git libsepol-2.8/src/kernel_to_cil.c libsepol-2.8/src/kernel_to_cil.c
|
|
|
c411eb |
index b1eb66d..8d58e04 100644
|
|
|
c411eb |
--- libsepol-2.8/src/kernel_to_cil.c
|
|
|
c411eb |
+++ libsepol-2.8/src/kernel_to_cil.c
|
|
|
c411eb |
@@ -2019,6 +2019,8 @@ static int write_cond_av_list_to_cil(FILE *out, struct policydb *pdb, cond_av_li
|
|
|
c411eb |
return 0;
|
|
|
c411eb |
|
|
|
c411eb |
exit:
|
|
|
c411eb |
+ strs_free_all(strs);
|
|
|
c411eb |
+ strs_destroy(&strs;;
|
|
|
c411eb |
return rc;
|
|
|
c411eb |
}
|
|
|
c411eb |
|
|
|
c411eb |
diff --git libsepol-2.8/src/kernel_to_common.c libsepol-2.8/src/kernel_to_common.c
|
|
|
c411eb |
index 342bc3c..19a8c0e 100644
|
|
|
c411eb |
--- libsepol-2.8/src/kernel_to_common.c
|
|
|
c411eb |
+++ libsepol-2.8/src/kernel_to_common.c
|
|
|
c411eb |
@@ -80,10 +80,12 @@ static char *create_str_helper(const char *fmt, int num, va_list vargs)
|
|
|
c411eb |
goto exit;
|
|
|
c411eb |
}
|
|
|
c411eb |
|
|
|
c411eb |
+ va_end(vargs2);
|
|
|
c411eb |
return str;
|
|
|
c411eb |
|
|
|
c411eb |
exit:
|
|
|
c411eb |
free(str);
|
|
|
c411eb |
+ va_end(vargs2);
|
|
|
c411eb |
return NULL;
|
|
|
c411eb |
}
|
|
|
c411eb |
|
|
|
c411eb |
diff --git libsepol-2.8/src/kernel_to_conf.c libsepol-2.8/src/kernel_to_conf.c
|
|
|
c411eb |
index 9540520..a74e6c4 100644
|
|
|
c411eb |
--- libsepol-2.8/src/kernel_to_conf.c
|
|
|
c411eb |
+++ libsepol-2.8/src/kernel_to_conf.c
|
|
|
c411eb |
@@ -1987,6 +1987,8 @@ static int write_cond_av_list_to_conf(FILE *out, struct policydb *pdb, cond_av_l
|
|
|
c411eb |
return 0;
|
|
|
c411eb |
|
|
|
c411eb |
exit:
|
|
|
c411eb |
+ strs_free_all(strs);
|
|
|
c411eb |
+ strs_destroy(&strs;;
|
|
|
c411eb |
return rc;
|
|
|
c411eb |
}
|
|
|
c411eb |
|