Fix NULL pointer reference when using basic match

If basic match has no tree of matches underneath
then print_ematch would core dump.
This commit is contained in:
Stephen Hemminger 2010-07-29 18:03:35 -07:00
parent 4dbda0f482
commit 4b45abd1f0

View File

@ -449,12 +449,14 @@ static int print_ematch_list(FILE *fd, struct tcf_ematch_tree_hdr *hdr,
if (tb == NULL)
return -1;
if (parse_rtattr_nested(tb, hdr->nmatches, rta) < 0)
goto errout;
if (hdr->nmatches > 0) {
if (parse_rtattr_nested(tb, hdr->nmatches, rta) < 0)
goto errout;
fprintf(fd, "\n ");
if (print_ematch_seq(fd, tb, 1, 1) < 0)
goto errout;
fprintf(fd, "\n ");
if (print_ematch_seq(fd, tb, 1, 1) < 0)
goto errout;
}
err = 0;
errout: