Skip to content

Commit bcedc00

Browse files
committed
Plug a memory leak
Error: RESOURCE_LEAK (CWE-772): [#def15] openscap-1.3.0_alpha1/src/OVAL/oval_probe_ext.c:134: alloc_fn: Storage is returned from allocation function "malloc". openscap-1.3.0_alpha1/src/OVAL/oval_probe_ext.c:134: var_assign: Assigning: "pd" = storage returned from "malloc(16UL)". openscap-1.3.0_alpha1/src/OVAL/oval_probe_ext.c:142: leaked_storage: Variable "pd" going out of scope leaks the storage it points to. 140| 141| if (tbl->memb == NULL) { 142|-> return -1; 143| } 144|
1 parent 2e25017 commit bcedc00

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/OVAL/oval_probe_ext.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ static int oval_pdtbl_add(oval_pdtbl_t *tbl, oval_subtype_t type, int sd, const
140140
tbl->memb = realloc(tbl->memb, sizeof(oval_pd_t *) * (++tbl->count));
141141

142142
if (tbl->memb == NULL) {
143+
free(pd);
143144
return -1;
144145
}
145146

0 commit comments

Comments
 (0)