Fixed a couple of memory leaks.

This commit is contained in:
Moritz Bunkus 2007-06-25 10:39:26 +00:00
parent 89d0e2ea60
commit 1cf47a12f2
3 changed files with 8 additions and 6 deletions

View File

@ -1,3 +1,7 @@
2007-06-25 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fixes: Fixed a couple of memory leaks.
2007-06-24 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: new feature: Added better checks if two tracks can be

View File

@ -500,8 +500,7 @@ mpeg4::p10::nalu_to_rbsp(memory_cptr &buffer) {
d.write_uint8(b[pos]);
}
buffer = memory_cptr(new memory_c(d.get_and_lock_buffer(),
d.getFilePointer()));
buffer = memory_cptr(new memory_c(d.get_and_lock_buffer(), d.getFilePointer(), true));
}
void
@ -522,8 +521,7 @@ mpeg4::p10::rbsp_to_nalu(memory_cptr &buffer) {
d.write_uint8(b[pos]);
}
buffer = memory_cptr(new memory_c(d.get_and_lock_buffer(),
d.getFilePointer()));
buffer = memory_cptr(new memory_c(d.get_and_lock_buffer(), d.getFilePointer(), true));
}
bool
@ -532,7 +530,7 @@ mpeg4::p10::parse_sps(memory_cptr &buffer,
bool keep_ar_info) {
int size = buffer->get_size();
unsigned char *newsps = (unsigned char *)safemalloc(size + 100);
memory_cptr mcptr_newsps(new memory_c(newsps, size));
memory_cptr mcptr_newsps(new memory_c(newsps, size, true));
bit_cursor_c r(buffer->get(), size);
bit_writer_c w(newsps, size);
int i, nref, mb_width, mb_height;

View File

@ -890,7 +890,7 @@ mpeg4_p10_video_packetizer_c::change_nalu_size_len(packet_cptr packet) {
// than the previous one. Otherwise reuse the existing memory.
if (m_nalu_size_len_dst > m_nalu_size_len_src) {
int new_size = size + nalu_sizes.size() * (m_nalu_size_len_dst - m_nalu_size_len_src);
packet->data = memory_cptr(new memory_c((unsigned char *)safemalloc(new_size), new_size));
packet->data = memory_cptr(new memory_c((unsigned char *)safemalloc(new_size), new_size, true));
}
// Copy the NALUs and write the new sized length field.