mirror of
https://github.com/boostorg/interprocess.git
synced 2026-01-19 04:12:13 +00:00
Fixes #80 ("realloc in interprocess's c_heap_deleter can leak memory")
This commit is contained in:
@@ -1862,10 +1862,10 @@ class c_heap_deleter
|
||||
|
||||
void realloc_mem(std::size_t num_bytes)
|
||||
{
|
||||
void *buf = ::realloc(m_buf, num_bytes);
|
||||
if(!buf){
|
||||
free(m_buf);
|
||||
m_buf = 0;
|
||||
void *oldBuf = m_buf;
|
||||
m_buf = ::realloc(m_buf, num_bytes);
|
||||
if (!m_buf){
|
||||
free(oldBuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user