https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90225

            Bug ID: 90225
           Summary: Resource leak..
           Product: gcc
           Version: 6.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: venkateshprabu at gmail dot com
  Target Milestone: ---

File:



 Resource leak
The system resource will not be reclaimed and reused, reducing the future
availability of the resource.

In std::​unordered_map<std::​__cxx11::​basic_string<char,
std::​char_traits<char>, std::​allocator<char>>,
std::​__cxx11::​basic_string<char, std::​char_traits<char>,
std::​allocator<char>>, std::​hash<std::​__cxx11::​basic_string<char,
std::​char_traits<char>, std::​allocator<char>>>,
std::​equal_to<std::​__cxx11::​basic_string<char, std::​char_traits<char>,
std::​allocator<char>>>,
std::​allocator<std::​pair<std::​__cxx11::​basic_string<char,
std::​char_traits<char>, std::​allocator<char>> const,
std::​__cxx11::​basic_string<char, std::​char_traits<char>,
std::​allocator<char>>>>>::​operator
=(std::​unordered_map<std::​__cxx11::​basic_string<char,
std::​char_traits<char>, std::​allocator<char>>,
std::​__cxx11::​basic_string<char, std::​char_traits<char>,
std::​allocator<char>>, std::​hash<std::​__cxx11::​basic_string<char,
std::​char_traits<char>, std::​allocator<char>>>,
std::​equal_to<std::​__cxx11::​basic_string<char, std::​char_traits<char>,
std::​allocator<char>>>,
std::​allocator<std::​pair<std::​__cxx11::​basic_string<char,
std::​char_traits<char>, std::​allocator<char>> const,
std::​__cxx11::​basic_string<char, std::​char_traits<char>,
std::​allocator<char>>>>> const &): Leak of memory or pointers to system
resources (CWE-404)


Is this false positive by coverity?


Coverity report:

     unordered_map(initializer_list<value_type> __l,
255                    size_type __n, const hasher& __hf,
256                    const allocator_type& __a)
257      : unordered_map(__l, __n, __hf, key_equal(), __a)
258      { }
259
260      /// Copy assignment operator.
261      unordered_map&
        1. alloc_arg: operator = allocates memory that is stored into
this->_M_h._M_buckets. [show details]

CID 8650859 (#1 of 1): Resource leak (RESOURCE_LEAK)
2. overwrite_var: Overwriting this->_M_h._M_buckets in call to operator = leaks
the storage that this->_M_h._M_buckets points to. [show details]
262      operator=(const unordered_map&) = default;
263
264      /// Move assignment operator.
265      unordered_map&
266      operator=(unordered_map&&) = default;
267
268      /**
269       *  @brief  %Unordered_map list assignment operator.
270       *  @param  __l  An initializer_list.
271       *
272       *  This function fills an %unordered_map with copies of the elements
in
273       *  the initializer list @a __l.
274       *

Reply via email to