diff options
author | sahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-03-31 20:50:13 +0000 |
---|---|---|
committer | sahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-03-31 20:50:13 +0000 |
commit | ac2f4daf9fc677b4e185b5baf1d189b1c5185ccb (patch) | |
tree | ba49697d969cba6473e51af65303c9af4bfeff35 /tools | |
parent | f93ec58204d73d0940b37bc97f6147809d32deea (diff) |
Memory leak in lemon.c
coverity 1177
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@36427 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lemon/lemon.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/lemon/lemon.c b/tools/lemon/lemon.c index 25ec059368..78bcf3198f 100644 --- a/tools/lemon/lemon.c +++ b/tools/lemon/lemon.c @@ -3128,15 +3128,15 @@ PRIVATE void tplt_xfer(const char *name, FILE *in, FILE *out, int *lineno) PRIVATE FILE *tplt_open(struct lemon *lemp) { static char templatename[] = "lempar.c"; - char* buf; FILE *in; char *tpltname = NULL; char *cp; if (lemp->templatename) { tpltname = strdup(lemp->templatename); - } - else { + } else { + char* buf; + cp = strrchr(lemp->filename,'.'); buf = malloc(1000); if( cp ){ @@ -3145,13 +3145,13 @@ PRIVATE FILE *tplt_open(struct lemon *lemp) sprintf(buf,"%s.lt",lemp->filename); } if( access(buf,004)==0 ){ - tpltname = buf; + tpltname = strdup(buf); }else if( access(templatename,004)==0 ){ tpltname = strdup(templatename); }else{ tpltname = pathsearch(lemp->argv0,templatename,0); - free(buf); } + free(buf); } if( tpltname==0 ){ fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", |