Fixed a couple of memleaks.

This commit is contained in:
Moritz Bunkus 2004-01-22 12:55:21 +00:00
parent 57044fdb73
commit 679456b40e
3 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2004-01-22 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: Fixed a couple of memory leaks, especially in
the QuickTime/MP4 parser.
2004-01-21 Moritz Bunkus <moritz@bunkus.org>
* mmg: Added some more extensions for RealMedia files.

View File

@ -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);

View File

@ -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;
}