From cf49fd0c981fff258c484287ecd862172ff5a55c Mon Sep 17 00:00:00 2001 From: Kp Date: Wed, 18 Dec 2013 21:02:10 +0000 Subject: [PATCH] Fix memory leak in audio conversion --- d2x-rebirth/libmve/mveplay.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/d2x-rebirth/libmve/mveplay.cpp b/d2x-rebirth/libmve/mveplay.cpp index 023387ea2..511c5ca74 100644 --- a/d2x-rebirth/libmve/mveplay.cpp +++ b/d2x-rebirth/libmve/mveplay.cpp @@ -34,6 +34,7 @@ #include "libmve.h" #include "args.h" #include "console.h" +#include "u_mem.h" #define MVE_OPCODE_ENDOFSTREAM 0x00 #define MVE_OPCODE_ENDOFCHUNK 0x01 @@ -476,7 +477,9 @@ static int audio_data_handler(unsigned char major, unsigned char minor, unsigned out_format, out_channels, out_freq); clen = nsamp * cvt.len_mult; - cvt.buf = (Uint8 *) malloc(clen); + RAIIdmem cvtbuf; + MALLOC(cvtbuf, Uint8, clen); + cvt.buf = cvtbuf; cvt.len = nsamp; // read the audio buffer into the conversion buffer