35 lines
1.7 KiB
Diff
35 lines
1.7 KiB
Diff
From: Jan Cerny <jcerny@redhat.com>
|
|
Date: Thu, 27 Jan 2022 15:16:02 +0100
|
|
Subject: [PATCH] Add a missing free
|
|
|
|
Addressing:
|
|
Error: RESOURCE_LEAK (CWE-772): [#def4] [important]
|
|
openscap-1.3.6/src/XCCDF_POLICY/xccdf_policy.c:2144: alloc_fn: Storage is returned from allocation function "oscap_htable_iterator_new".
|
|
openscap-1.3.6/src/XCCDF_POLICY/xccdf_policy.c:2144: var_assign: Assigning: "rit" = storage returned from "oscap_htable_iterator_new(policy->rules)".
|
|
openscap-1.3.6/src/XCCDF_POLICY/xccdf_policy.c:2145: noescape: Resource "rit" is not freed or pointed-to in "oscap_htable_iterator_has_more".
|
|
openscap-1.3.6/src/XCCDF_POLICY/xccdf_policy.c:2146: noescape: Resource "rit" is not freed or pointed-to in "oscap_htable_iterator_next_key".
|
|
openscap-1.3.6/src/XCCDF_POLICY/xccdf_policy.c:2150: leaked_storage: Variable "rit" going out of scope leaks the storage it points to.
|
|
2148| oscap_seterr(OSCAP_EFAMILY_XCCDF,
|
|
2149| "Rule '%s' not found in selected profile.", rule_id);
|
|
2150|-> return NULL;
|
|
2151| }
|
|
2152| }
|
|
|
|
Origin: upstream, https://github.com/OpenSCAP/openscap/commit/6ef54336a018566a32f6a95177635ada7f20794e
|
|
---
|
|
src/XCCDF_POLICY/xccdf_policy.c | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
|
|
diff --git a/src/XCCDF_POLICY/xccdf_policy.c b/src/XCCDF_POLICY/xccdf_policy.c
|
|
index b63853a38f..4d4b7ad0a1 100644
|
|
--- a/src/XCCDF_POLICY/xccdf_policy.c
|
|
+++ b/src/XCCDF_POLICY/xccdf_policy.c
|
|
@@ -2147,6 +2147,7 @@ struct xccdf_result * xccdf_policy_evaluate(struct xccdf_policy * policy)
|
|
if (oscap_htable_get(policy->rules_found, rule_id) == NULL) {
|
|
oscap_seterr(OSCAP_EFAMILY_XCCDF,
|
|
"Rule '%s' not found in selected profile.", rule_id);
|
|
+ oscap_htable_iterator_free(rit);
|
|
return NULL;
|
|
}
|
|
}
|