mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-28 13:57:22 +00:00
NALU↔RBSP conversion functions: don't leak memory
mm_mem_io_c allocates a buffer. Calling get_and_lock_buffer() on it will return the buffer and disassociate it from mm_mem_io_c, meaning the mm_mem_io_c instance won't free it itself. Then cloning from this already disassociated buffer is a superfluous memory copy for one and it fails to free the buffer causing a massive memory leak.
This commit is contained in:
parent
1d419d5655
commit
2aeddd12f3
@ -35,7 +35,7 @@ nalu_to_rbsp(memory_cptr const &buffer) {
|
||||
d.write_uint8(b[pos]);
|
||||
}
|
||||
|
||||
return memory_c::clone(d.get_and_lock_buffer(), d.getFilePointer());
|
||||
return std::make_shared<memory_c>(d.get_and_lock_buffer(), d.getFilePointer(), true);
|
||||
}
|
||||
|
||||
memory_cptr
|
||||
@ -58,7 +58,7 @@ rbsp_to_nalu(memory_cptr const &buffer) {
|
||||
d.write_uint8(b[pos]);
|
||||
}
|
||||
|
||||
return memory_c::clone(d.get_and_lock_buffer(), d.getFilePointer());
|
||||
return std::make_shared<memory_c>(d.get_and_lock_buffer(), d.getFilePointer(), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user