From be83114f40ffb05313c584a175fd8c92d6c79f92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 8 Jan 2024 14:35:51 +0100 Subject: [PATCH] Drop unreachable OOM branches Since commit 40faacbd ("Check memory allocation") memory allocations use a wrapper that checks internally for OOM. Remove the unreachable branches at caller sites. --- src/parse_functions.c | 3 --- src/tree.c | 7 ------- 2 files changed, 10 deletions(-) diff --git a/src/parse_functions.c b/src/parse_functions.c index b1f0798b..fd53379e 100644 --- a/src/parse_functions.c +++ b/src/parse_functions.c @@ -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; diff --git a/src/tree.c b/src/tree.c index 4a9d9451..92cd482e 100644 --- a/src/tree.c +++ b/src/tree.c @@ -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; @@ -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;