From fe0524a11bba30d5cd66d0ff839963feeac48acd Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 21 Sep 2008 16:11:22 +0000 Subject: [PATCH] Allocate memory with proper length and deallocate the memory afterwards. --- src/input/r_mpeg_ps.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/input/r_mpeg_ps.cpp b/src/input/r_mpeg_ps.cpp index 39d4b7ac4..5a07ff3f9 100644 --- a/src/input/r_mpeg_ps.cpp +++ b/src/input/r_mpeg_ps.cpp @@ -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)) continue; - memory_c new_buf((unsigned char *)safemalloc(length), 0, true); - if (io->read(new_buf.get(), new_length) != new_length) + memory_cptr new_buf = memory_c::alloc(new_length); + if (io->read(new_buf->get(), new_length) != new_length) throw false; - buffer.add(new_buf.get(), new_length); + buffer.add(new_buf->get(), new_length); } } catch (...) {