From 60276cdf2efd073c9324b5c91fdd318800884724 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sat, 29 Aug 2009 23:48:29 +0000 Subject: [PATCH] fix memory leak and otherwise stabilize code in emufile --- desmume/src/emufile.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/desmume/src/emufile.h b/desmume/src/emufile.h index 97197db12..8de07045a 100644 --- a/desmume/src/emufile.h +++ b/desmume/src/emufile.h @@ -107,12 +107,9 @@ public: int amt = vsnprintf(0,0,format,argptr); char* tempbuf = new char[amt+1]; vsprintf(tempbuf,format,argptr); - memcpy((char*)buf()+pos,tempbuf,amt); - pos += amt; - len = std::max(pos,len); - + fwrite(tempbuf,amt); + delete[] tempbuf; va_end(argptr); - return amt; };