From 1cf47a12f2d4085b36d9a0c9752d387a7826651a Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 25 Jun 2007 10:39:26 +0000 Subject: [PATCH] Fixed a couple of memory leaks. --- ChangeLog | 4 ++++ src/common/mpeg4_common.cpp | 8 +++----- src/output/p_video.cpp | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4eb0f6e1d..a6de3142e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-06-25 Moritz Bunkus + + * mkvmerge: bug fixes: Fixed a couple of memory leaks. + 2007-06-24 Moritz Bunkus * mkvmerge: new feature: Added better checks if two tracks can be diff --git a/src/common/mpeg4_common.cpp b/src/common/mpeg4_common.cpp index 2f58ff6bc..37b01a4c2 100644 --- a/src/common/mpeg4_common.cpp +++ b/src/common/mpeg4_common.cpp @@ -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; diff --git a/src/output/p_video.cpp b/src/output/p_video.cpp index 4681ccde0..d67fe8776 100644 --- a/src/output/p_video.cpp +++ b/src/output/p_video.cpp @@ -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.