diff options
author | ngie <ngie@FreeBSD.org> | 2016-04-22 05:24:15 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2016-04-22 05:24:15 +0000 |
commit | 075957409e5fa19bcfde30525ea3a71880195bf7 (patch) | |
tree | dd54e4bbdfb53f1bbe5aeca5e860029797434cf9 /contrib/bsnmp/gensnmptree | |
parent | e78e1803876a8d9c2ece3740993b3ba2ce6bbcdf (diff) | |
download | FreeBSD-src-075957409e5fa19bcfde30525ea3a71880195bf7.zip FreeBSD-src-075957409e5fa19bcfde30525ea3a71880195bf7.tar.gz |
Simplify always evaluated branch (`e != NULL`)
- xalloc(..) ensures that e will be non-null via malloc + err.
- `e` is already dereferenced above, so logically it's impossible
to hit the lower test without crashing if it was indeed NULL.
MFC after: 3 days
CID: 1007408
Reported by: Coverity
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'contrib/bsnmp/gensnmptree')
-rw-r--r-- | contrib/bsnmp/gensnmptree/gensnmptree.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/contrib/bsnmp/gensnmptree/gensnmptree.c b/contrib/bsnmp/gensnmptree/gensnmptree.c index b69d739..0eca777 100644 --- a/contrib/bsnmp/gensnmptree/gensnmptree.c +++ b/contrib/bsnmp/gensnmptree/gensnmptree.c @@ -743,10 +743,8 @@ parse_type(enum tok *tok, struct type *t, const char *vname) report("need value for ENUM/BITS"); if (gettoken() != TOK_STR) report("need string in ENUM/BITS"); - if (e != NULL) { - e->name = savetok(); - TAILQ_INSERT_TAIL(&t->enums, e, link); - } + e->name = savetok(); + TAILQ_INSERT_TAIL(&t->enums, e, link); if ((*tok = gettoken()) == TOK_EOF) report("unexpected EOF in ENUM/BITS"); } while (*tok != ')'); |