diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2022-01-06 04:39:59 -0500 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2022-01-06 05:00:40 -0500 |
commit | 8ebe1c533379b9981ba52b922b3ad29011a5ffca (patch) | |
tree | 45e8722043cf3e874a2fbd8c6b2a72849341cc26 /src/lemon.c | |
parent | c0f040eae744e8688045d892d4fa150a7041a82b (diff) | |
download | lighttpd-git-8ebe1c533379b9981ba52b922b3ad29011a5ffca.tar.gz |
[lemon] silence coverity warnings
Diffstat (limited to 'src/lemon.c')
-rw-r--r-- | src/lemon.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lemon.c b/src/lemon.c index 23115e78..5d35db71 100644 --- a/src/lemon.c +++ b/src/lemon.c @@ -448,13 +448,11 @@ struct acttab { #define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead) /* Free all memory associated with the given acttab */ -/* PRIVATE void acttab_free(acttab *p){ free( p->aAction ); free( p->aLookahead ); free( p ); } -*/ /* Allocate a new acttab structure */ PRIVATE acttab *acttab_alloc(void){ @@ -1704,6 +1702,7 @@ FILE *err; int j; int errcnt = 0; cp = strchr(argv[i],'='); + if( NULL == cp ) return 1; /*(should not happen; checked by caller)*/ *cp = 0; for(j=0; op[j].label; j++){ if( strcmp(argv[i],op[j].label)==0 ) break; @@ -2325,6 +2324,7 @@ struct lemon *gp; int c; char *cp, *nextcp; int startline = 0; + long epos; ps.gp = gp; ps.filename = gp->filename; @@ -2339,7 +2339,14 @@ struct lemon *gp; return; } fseek(fp,0,2); - filesize = ftell(fp); + epos = ftell(fp); + if( -1 == epos ) { + ErrorMsg(ps.filename,0,"Can't determine file size."); + fclose(fp); + gp->errorcnt++; + return; + } + filesize = (size_t)epos; rewind(fp); filebuf = (char *)malloc( filesize+1 ); if( filebuf==0 ){ @@ -3586,6 +3593,7 @@ int mhflag; /* Output in makeheaders format if true */ /* Append any addition code the user desires */ tplt_print(out,lemp,lemp->extracode,lemp->extracodeln,&lineno); + acttab_free(pActtab); fclose(in); fclose(out); return; |