[Boost-bugs] [Boost C++ Libraries] #10753: interprocess::winapi::c_heap_deleter::realloc_mem leaks memory

Subject: [Boost-bugs] [Boost C++ Libraries] #10753: interprocess::winapi::c_heap_deleter::realloc_mem leaks memory
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-11-05 15:44:31


#10753: interprocess::winapi::c_heap_deleter::realloc_mem leaks memory
-----------------------------------------+--------------------------
 Reporter: Tomasz Wilk <tomasz.wilk@…> | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
  Version: Boost 1.57.0 | Severity: Problem
 Keywords: |
-----------------------------------------+--------------------------
 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;
       }
    }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10753>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC