The definition of the function is in c-inpath.c as following.
void
split_quote_chain (void)
{
  heads[QUOTE] = heads[BRACKET];
  tails[QUOTE] = tails[BRACKET];
  heads[BRACKET] = NULL;
  tails[BRACKET] = NULL;
  /* This is NOT redundant.  */
  quote_ignores_source_dir = true;
}

The elements in heads and tails point to the head and tail of certain list, and
the items in these lists are xmalloc in add_path. For above operation, memory
allocated for QUOTE list is leaked. Seems should invoke free_path first to
release the resource before the assignment.
This leakage will happen if we use -I- switch!


-- 
           Summary: memleak in split_quote_chain
           Product: gcc
           Version: 3.4.6
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wuhui1973 at 21cn dot com
 GCC build triplet: i686-dell-linux
  GCC host triplet: i686-dell-linux
GCC target triplet: i686-dell-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36819

Reply via email to