Skip to content

Commit

Permalink
Drop unreachable OOM branches
Browse files Browse the repository at this point in the history
Since commit 40faacb ("Check memory allocation") memory allocations use
a wrapper that checks internally for OOM.  Remove the unreachable
branches at caller sites.
  • Loading branch information
cgzones authored and dburgener committed Jan 8, 2024
1 parent 60fa57b commit 248d83d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
3 changes: 0 additions & 3 deletions src/parse_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,9 +803,6 @@ static enum node_flavor attr_to_node_flavor(enum attr_flavor flavor)
static enum selint_error insert_attribute(struct policy_node **cur, enum attr_flavor flavor, const char *type, struct string_list *attrs, unsigned int lineno)
{
struct attribute_data *data = xcalloc(1, sizeof(struct attribute_data));
if (!data) {
return SELINT_OUT_OF_MEM;
}
union node_data nd;
nd.at_data = data;

Expand Down
7 changes: 0 additions & 7 deletions src/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ enum selint_error insert_policy_node_child(struct policy_node *parent,
}

struct policy_node *to_insert = xmalloc(sizeof(struct policy_node));
if (!to_insert) {
return SELINT_OUT_OF_MEM;
}

to_insert->parent = parent;
to_insert->next = NULL;
to_insert->first_child = NULL;
Expand Down Expand Up @@ -73,9 +69,6 @@ enum selint_error insert_policy_node_next(struct policy_node *prev,
}

struct policy_node *to_insert = xmalloc(sizeof(struct policy_node));
if (!to_insert) {
return SELINT_OUT_OF_MEM;
}

prev->next = to_insert;

Expand Down

0 comments on commit 248d83d

Please sign in to comment.