From a76c6cfa429b4dd204b14999d27187faa61d0541 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 28 Dec 2016 16:15:02 +0100 Subject: lemon: Fix Dereference of null pointer found by Clang analyzer lemon.c:877:10: warning: Access to field 'lhs' results in a dereference of a null pointer (loaded from field 'startRule') lemon.c:1141:22: warning: Access to field 'lhs' results in a dereference of a null pointer (loaded from field 'startRule') it is false positve lem.nrule==0 implies lem.rule==NULL Change-Id: Id63086990762fbf5195bce34a28f25aeb7a246f7 Reviewed-on: https://code.wireshark.org/review/19445 Petri-Dish: Alexis La Goutte Reviewed-by: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- tools/lemon/lemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lemon/lemon.c b/tools/lemon/lemon.c index c7d4d1da2e..de0ae2362b 100644 --- a/tools/lemon/lemon.c +++ b/tools/lemon/lemon.c @@ -1669,7 +1669,7 @@ int main(int argc _U_, char **argv) /* Parse the input file */ Parse(&lem); if( lem.errorcnt ) exit(lem.errorcnt); - if( lem.nrule==0 ){ + if( lem.nrule==0 || lem.rule == NULL ){ fprintf(stderr,"Empty grammar.\n"); exit(1); } -- cgit v1.2.3