From fceeb4756cced62f2fc045f932f798c899addc41 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Thu, 20 Jan 2011 16:56:43 +0000 Subject: [PATCH] Fix 2 leaks. (unlikely to occur though) Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3670 --- src/debug/debug.cpp | 6 +++--- src/hardware/serialport/libserial.cpp | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/debug/debug.cpp b/src/debug/debug.cpp index ae573722..d85cd832 100644 --- a/src/debug/debug.cpp +++ b/src/debug/debug.cpp @@ -2174,11 +2174,11 @@ CDebugVar* CDebugVar::FindVar(PhysPt pt) return 0; }; -bool CDebugVar::SaveVars(char* name) -{ +bool CDebugVar::SaveVars(char* name) { + if (varList.size()>65535) return false; + FILE* f = fopen(name,"wb+"); if (!f) return false; - if (varList.size()>65535) return false; // write number of vars Bit16u num = (Bit16u)varList.size(); diff --git a/src/hardware/serialport/libserial.cpp b/src/hardware/serialport/libserial.cpp index 5d66851d..d8d6fa58 100644 --- a/src/hardware/serialport/libserial.cpp +++ b/src/hardware/serialport/libserial.cpp @@ -45,6 +45,7 @@ bool SERIAL_open(const char* portname, COMPORT* port) { int len = strlen(portname); if(len > 240) { SetLastError(ERROR_BUFFER_OVERFLOW); + free(cp); return false; } char extended_portname[256] = "\\\\.\\";