Skip to content

Commit 7df6475

Browse files
committed
Relocated variable declarations to supress static checkers false positives.
1 parent a79f0e3 commit 7df6475

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/OVAL/probes/independent/textfilecontent.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ static int process_file(const char *prefix, const char *path, const char *filena
245245
char *whole_path = NULL, *whole_path_with_prefix = NULL;
246246
FILE *fp = NULL;
247247
struct stat st;
248+
char **substrs = NULL;
249+
int substr_cnt = 0;
248250

249251
// todo: move to probe_main()?
250252
#if defined USE_REGEX_PCRE
@@ -302,9 +304,6 @@ static int process_file(const char *prefix, const char *path, const char *filena
302304
char line[4096];
303305

304306
while (fgets(line, sizeof(line), fp) != NULL) {
305-
char **substrs;
306-
int substr_cnt;
307-
308307
substr_cnt = get_substrings(line, re, 1, &substrs);
309308
if (substr_cnt > 0) {
310309
int k;

src/OVAL/probes/independent/textfilecontent54.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ static int process_file(const char *prefix, const char *path, const char *file,
233233
struct pfdata *pfd = (struct pfdata *) arg;
234234
int ret = 0, path_len, file_len, cur_inst = 0, fd = -1, substr_cnt,
235235
buf_size = 0, buf_used = 0, ofs = 0, buf_inc = 4096;
236+
char **substrs = NULL;
236237
char *whole_path = NULL, *whole_path_with_prefix = NULL, *buf = NULL;
237238
SEXP_t *next_inst = NULL;
238239
struct stat st;
@@ -302,7 +303,6 @@ static int process_file(const char *prefix, const char *path, const char *file,
302303
buf[buf_used++] = '\0';
303304

304305
do {
305-
char **substrs;
306306
int want_instance;
307307

308308
next_inst = SEXP_number_newi_32(cur_inst + 1);

0 commit comments

Comments
 (0)