Skip to content

Commit c69e157

Browse files
committed
cfgparser: fix dereference before assert
Coverity: CID 739688 (#1 of 1): Dereference before null check (REVERSE_INULL) Null-checking "in->cnf" suggests that it may be null, but it has already been dereferenced on all paths leading to the check. Signed-off-by: Ferry Huberts <[email protected]>
1 parent b859cec commit c69e157

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/cfgparser/olsrd_conf.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,9 @@ olsrd_sanity_check_cnf(struct olsrd_config *cnf)
603603
while (in) {
604604
struct olsr_lq_mult *mult, *mult_orig;
605605

606+
assert(in->cnf);
607+
assert(in->cnfi);
608+
606609
io = in->cnf;
607610

608611
olsrd_print_interface_cnf(in->cnf, in->cnfi, false);
@@ -618,8 +621,6 @@ olsrd_sanity_check_cnf(struct olsrd_config *cnf)
618621
/*save interface specific lqmults, as they are merged togehter later*/
619622
mult_orig = io->lq_mult;
620623

621-
assert(in->cnf);
622-
assert(in->cnfi);
623624
for (pos = 0; pos < sizeof(*in->cnf); pos++) {
624625
if (cnfptr[pos] != cnfiptr[pos]) {
625626
cnfptr[pos] = defptr[pos]; cnfiptr[pos]=0x00;

0 commit comments

Comments
 (0)