Skip to content

Commit 5a3bb29

Browse files
committed
Fix leak in textfilecontent_probe
The leak was found after assume_d macro was replace by if code. - Move the free for line_ent and ent_val before check for error condition, they should be freed anyway. - Add free for other leaking SEXP variables.
1 parent 2e25017 commit 5a3bb29

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/OVAL/probes/independent/textfilecontent_probe.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,15 @@ int textfilecontent_probe_main(probe_ctx *ctx, void *arg)
311311
SEXP_t *ent_val;
312312
ent_val = probe_ent_getval(line_ent);
313313
pattern = SEXP_string_cstr(ent_val);
314+
SEXP_free(line_ent);
315+
SEXP_free(ent_val);
314316
if (pattern == NULL) {
317+
SEXP_free(path_ent);
318+
SEXP_free(filename_ent);
319+
SEXP_free(filepath_ent);
320+
SEXP_free(behaviors_ent);
315321
return -1;
316322
}
317-
SEXP_free(line_ent);
318-
SEXP_free(ent_val);
319323

320324
/* behaviours are not important if filepath is used */
321325
if(filepath_ent != NULL && behaviors_ent != NULL) {

0 commit comments

Comments
 (0)