Opened 8 years ago

#10753 new Bugs

interprocess::winapi::c_heap_deleter::realloc_mem leaks memory

Reported by: Tomasz Wilk <tomasz.wilk@…> Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description

Hi,

We believe that there is a memory leak in boost::interprocess::winapi::c_heap_deleter::realloc_mem

boost/interprocess/detail/win32_api.hpp:1790-1797

void realloc_mem(std::size_t num_bytes)
   {
      void *buf = ::realloc(m_buf, num_bytes);
      if(!buf){
         free(m_buf);
         m_buf = 0;
      }
   }

should probably be

void realloc_mem(std::size_t num_bytes)
   {
      void *buf = ::realloc(m_buf, num_bytes);
      if(!buf){
         free(m_buf);
         m_buf = 0;
      }
      else {
         m_buf = buf;
      }
   }

Change History (0)

Note: See TracTickets for help on using tickets.