mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2025-01-04 09:15:05 +00:00
Allocate memory with proper length and deallocate the memory afterwards.
This commit is contained in:
parent
1f9efc5959
commit
fe0524a11b
@ -532,11 +532,11 @@ mpeg_ps_reader_c::new_stream_v_avc_or_mpeg_1_2(int id,
|
|||||||
if (!parse_packet(id, timecode, new_length, full_length, aid))
|
if (!parse_packet(id, timecode, new_length, full_length, aid))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
memory_c new_buf((unsigned char *)safemalloc(length), 0, true);
|
memory_cptr new_buf = memory_c::alloc(new_length);
|
||||||
if (io->read(new_buf.get(), new_length) != new_length)
|
if (io->read(new_buf->get(), new_length) != new_length)
|
||||||
throw false;
|
throw false;
|
||||||
|
|
||||||
buffer.add(new_buf.get(), new_length);
|
buffer.add(new_buf->get(), new_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
Loading…
Reference in New Issue
Block a user