emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem report #47


From: Dan Nicolaescu
Subject: Problem report #47
Date: Sun, 30 Apr 2006 09:46:08 -0700

CID: 47
Checker: RESOURCE_LEAK (help)
File: emacs/lib-src/etags.c
Function: Perl_functions
Description: Returned without freeing storage "package"

4473    static void
4474    Perl_functions (inf)
4475         FILE *inf;
4476    {

Event alloc_fn: Called allocation function "savestr" [model]
Event var_assign: Assigned variable "package" to storage returned from "savestr"
Also see events: [var_assign][leaked_storage]

4477      char *package = savestr ("main"); /* current package name */
4478      register char *cp;
4479    

At conditional (1): "feof == 0" taking false path

4480      LOOP_ON_INPUT_LINES (inf, lb, cp)
4481        {
4482          skip_spaces(cp);
4483    
4484          if (LOOKING_AT (cp, "package"))
4485            {
4486              free (package);
4487              get_tag (cp, &package);
4488            }
4489          else if (LOOKING_AT (cp, "sub"))
4490            {
4491              char *pos;
4492              char *sp = cp;
4493    
4494              while (!notinname (*cp))
4495                cp++;
4496              if (cp == sp)
4497                continue;           /* nothing found */
4498              if ((pos = etags_strchr (sp, ':')) != NULL
4499                  && pos < cp && pos[1] == ':')
4500                /* The name is already qualified. */
4501                make_tag (sp, cp - sp, TRUE,
4502                          lb.buffer, cp - lb.buffer + 1, lineno, 
linecharno);
4503              else
4504                /* Qualify it. */
4505                {
4506                  char savechar, *name;
4507    
4508                  savechar = *cp;
4509                  *cp = '\0';
4510                  name = concat (package, "::", sp);
4511                  *cp = savechar;
4512                  make_tag (name, strlen(name), TRUE,
4513                            lb.buffer, cp - lb.buffer + 1, lineno, 
linecharno);
4514                  free (name);
4515                }
4516            }
4517           else if (globals)        /* only if we are tagging global vars */
4518            {
4519              /* Skip a qualifier, if any. */
4520              bool qual = LOOKING_AT (cp, "my") || LOOKING_AT (cp, "local");
4521              /* After "my" or "local", but before any following paren or 
space. */
4522              char *varstart = cp;
4523    
4524              if (qual              /* should this be removed?  If yes, 
how? */
4525                  && (*cp == '$' || *cp == '@' || *cp == '%'))
4526                {
4527                  varstart += 1;
4528                  do
4529                    cp++;
4530                  while (ISALNUM (*cp) || *cp == '_');
4531                }
4532              else if (qual)
4533                {
4534                  /* Should be examining a variable list at this point;
4535                     could insist on seeing an open parenthesis. */
4536                  while (*cp != '\0' && *cp != ';' && *cp != '=' &&  *cp != 
')')
4537                    cp++;
4538                }
4539              else
4540                continue;
4541    
4542              make_tag (varstart, cp - varstart, FALSE,
4543                        lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
4544            }
4545        }

Event leaked_storage: Returned without freeing storage "package"
Also see events: [alloc_fn][var_assign]

4546    }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]