diff --git a/ChangeLog b/ChangeLog index 3c3a6bd0d..aab5facb2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-01-22 Moritz Bunkus + + * mkvmerge: bug fix: Fixed a couple of memory leaks, especially in + the QuickTime/MP4 parser. + 2004-01-21 Moritz Bunkus * mmg: Added some more extensions for RealMedia files. diff --git a/src/input/r_qtmp4.cpp b/src/input/r_qtmp4.cpp index 8c209ab41..e6ae0eb42 100644 --- a/src/input/r_qtmp4.cpp +++ b/src/input/r_qtmp4.cpp @@ -1071,6 +1071,7 @@ void qtmp4_reader_c::create_packetizer(int64_t tid) { ptzr->set_audio_sampling_freq(dmx->a_samplerate); ptzr->set_audio_channels(dmx->a_channels); ptzr->set_audio_bit_depth(dmx->a_bitdepth); + ptzr->duplicate_data_on_add(false); if (verbose) mxinfo("+-> Using generic audio output module for stream " @@ -1093,6 +1094,7 @@ void qtmp4_reader_c::create_packetizer(int64_t tid) { dmx->packetizer = new aac_packetizer_c(this, AAC_ID_MPEG4, profile, sample_rate, channels, ti, false, true); + dmx->packetizer->duplicate_data_on_add(false); if (sbraac) dmx->packetizer-> set_audio_output_sampling_freq(output_sample_rate); @@ -1110,6 +1112,7 @@ void qtmp4_reader_c::create_packetizer(int64_t tid) { dmx->a_channels, dmx->a_bitdepth, ti, (dmx->a_bitdepth > 8) && (dmx->fourcc[0] == 't')); + dmx->packetizer->duplicate_data_on_add(false); if (verbose) mxinfo("+-> Using PCM output module for stream %u.\n", dmx->id); diff --git a/src/output/p_pcm.cpp b/src/output/p_pcm.cpp index ec0d92382..d3f096855 100644 --- a/src/output/p_pcm.cpp +++ b/src/output/p_pcm.cpp @@ -96,7 +96,7 @@ pcm_packetizer_c::process(unsigned char *buf, int pad_size; pad_size = bps * initial_displacement / 1000; - new_buf = (unsigned char *)safemalloc(size + pad_size); + new_buf = (unsigned char *)safemalloc(pad_size); memset(new_buf, 0, pad_size); buffer.add(new_buf, pad_size); safefree(new_buf); @@ -116,11 +116,14 @@ pcm_packetizer_c::process(unsigned char *buf, skip_bytes = 0; } else new_buf = buf; + buffer.add(new_buf, size); + if (!duplicate_data) + safefree(buf); while (buffer.get_size() >= packet_size) { add_packet(buffer.get_buffer(), packet_size, bytes_output * 1000 / bps, - packet_size * 1000 / bps); + packet_size * 1000 / bps, false, -1, -1, -1, cp_yes); buffer.remove(packet_size); bytes_output += packet_size; }