Skip to content

Commit 176f1a8

Browse files
committed
Handle return value of probe_item_collect
The `probe_item_collect` function can fail and it can return various return codes. But, the return codes aren't handled in the caller function `process_file`. That means the `process_file` continues to process items even if no other items can be collected due to memory constraints or other problems. With this commit, we will read the return code of `probe_item_collect` and react accordingly.
1 parent 5e3d8bc commit 176f1a8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/OVAL/probes/independent/textfilecontent54_probe.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,14 @@ static int process_file(const char *prefix, const char *path, const char *file,
240240
item = create_item(path, file, pfd->pattern,
241241
cur_inst, substrs, substr_cnt, over);
242242

243-
probe_item_collect(pfd->ctx, item);
244-
245243
for (k = 0; k < substr_cnt; ++k)
246244
free(substrs[k]);
247245
free(substrs);
246+
int pic_ret = probe_item_collect(pfd->ctx, item);
247+
if (pic_ret == 2 || pic_ret == -1) {
248+
ret = -4;
249+
break;
250+
}
248251
}
249252
}
250253
} while (substr_cnt > 0 && ofs < buf_used);

0 commit comments

Comments
 (0)