aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2016-12-28 16:15:02 +0100
committerMichael Mann <mmann78@netscape.net>2016-12-30 00:56:18 +0000
commita76c6cfa429b4dd204b14999d27187faa61d0541 (patch)
tree71ebc869b249163cec1b80cf45b08e699883e3f6
parent255722c01ce7ffe42c4e8ff892f9493077a92229 (diff)
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 <alexis.lagoutte@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--tools/lemon/lemon.c2
1 files changed, 1 insertions, 1 deletions
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);
}