Skip to content

Commit 57481c3

Browse files
committed
Plug a memory leak
Addressing: openscap-1.3.0_alpha3/src/OVAL/results/oval_cmp_ip_address.c:208: alloc_fn: Storage is returned from allocation function "strdup". openscap-1.3.0_alpha3/src/OVAL/results/oval_cmp_ip_address.c:208: var_assign: Assigning: "s" = storage returned from "strdup(oval_ipv4_string)". openscap-1.3.0_alpha3/src/OVAL/results/oval_cmp_ip_address.c:209: identity_transfer: Passing "s" as argument 1 to function "strchr", which returns an offset off that argument. openscap-1.3.0_alpha3/src/OVAL/results/oval_cmp_ip_address.c:209: noescape: Resource "s" is not freed or pointed-to in "strchr". openscap-1.3.0_alpha3/src/OVAL/results/oval_cmp_ip_address.c:209: var_assign: Assigning: "pfx" = storage returned from "strchr(s, 47)". openscap-1.3.0_alpha3/src/OVAL/results/oval_cmp_ip_address.c:215: noescape: Resource "pfx" is not freed or pointed-to in "sscanf". openscap-1.3.0_alpha3/src/OVAL/results/oval_cmp_ip_address.c:222: leaked_storage: Variable "pfx" going out of scope leaks the storage it points to. openscap-1.3.0_alpha3/src/OVAL/results/oval_cmp_ip_address.c:222: leaked_storage: Variable "s" going out of scope leaks the storage it points to.
1 parent 76537af commit 57481c3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/OVAL/results/oval_cmp_ip_address.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ static inline int ipv4addr_parse(const char *oval_ipv4_string, uint32_t *netmask
219219
*netmask_out = (~0u) << (32u - nm[0]);
220220
} else {
221221
dW("Invalid prefix or netmask.");
222+
free(s);
222223
return -1;
223224
}
224225
} else {

0 commit comments

Comments
 (0)