[PATCH 3/9] route: remove unnecessary non-null check in pktloc and ematch

Thomas Haller thaller at redhat.com
Tue Jun 10 09:59:39 PDT 2014


This check is not necessary, especially since it causes a
coverity warning.

Signed-off-by: Thomas Haller <thaller at redhat.com>
---
 lib/route/cls/ematch.c | 4 +---
 lib/route/pktloc.c     | 3 +--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/route/cls/ematch.c b/lib/route/cls/ematch.c
index 779bf8b..ab30324 100644
--- a/lib/route/cls/ematch.c
+++ b/lib/route/cls/ematch.c
@@ -654,9 +654,7 @@ int rtnl_ematch_parse_expr(const char *expr, char **errp,
 		goto errout;
 	}
 
-	if (scanner)
-		ematch_lex_destroy(scanner);
-
+	ematch_lex_destroy(scanner);
 	*result = tree;
 
 	return 0;
diff --git a/lib/route/pktloc.c b/lib/route/pktloc.c
index 9fcf4a4..5bb841c 100644
--- a/lib/route/pktloc.c
+++ b/lib/route/pktloc.c
@@ -138,8 +138,7 @@ static int read_pktlocs(void)
 	last_read = st.st_mtime;
 
 errout_scanner:
-	if (scanner)
-		pktloc_lex_destroy(scanner);
+	pktloc_lex_destroy(scanner);
 errout_close:
 	fclose(fd);
 errout:
-- 
1.9.3




More information about the libnl mailing list