Skip to content

Commit

Permalink
Plug a memory leak
Browse files Browse the repository at this point in the history
Addressing this OpenScanHub issue:
2. Defect type: RESOURCE_LEAK
15. openscap-1.4.1/src/OVAL/probes/independent/textfilecontent_probe.c:203:3: alloc_arg: "oscap_pcre_get_substrings" allocates memory that is stored into "substrs".
17. openscap-1.4.1/src/OVAL/probes/independent/textfilecontent_probe.c:209:4: noescape: Resource "substrs" is not freed or pointed-to in "create_item".
28. openscap-1.4.1/src/OVAL/probes/independent/textfilecontent_probe.c:228:2: leaked_storage: Variable "substrs" going out of scope leaks the storage it points to.
   226|   	free(whole_path_with_prefix);
   227|
   228|-> 	return ret;
   229|   }
   230|
  • Loading branch information
jan-cerny committed Jan 10, 2025
1 parent f56d975 commit b8d638b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/OVAL/probes/independent/textfilecontent_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ static int process_file(const char *prefix, const char *path, const char *filena

for (k = 0; k < substr_cnt; ++k)
free(substrs[k]);
free(substrs);
}
}

Expand Down

0 comments on commit b8d638b

Please sign in to comment.