From 0feb0986f220126177084badf67813ccdbaa996c Mon Sep 17 00:00:00 2001 From: Daniels Umanovskis Date: Fri, 13 Mar 2020 13:48:19 +0100 Subject: [PATCH] Fix a rare memory leak in the register display window --- kdbg/regwnd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kdbg/regwnd.cpp b/kdbg/regwnd.cpp index edb0e55..93008f9 100644 --- a/kdbg/regwnd.cpp +++ b/kdbg/regwnd.cpp @@ -274,11 +274,12 @@ static char* toRaw(const QString& hex, uint& length) static bool littleendian=(*testChar==1); length=((hex.length()-2)%2)+((hex.length()-2)/2); + if (hex.length()<=2) return 0; + char* data=new char[length]; if (littleendian) { uint j=0; - if (hex.length()<=2) return 0; for (int i=hex.length()-1; i>=2; ) { if (j%2==0) data[j/2]=hexCharToDigit(hex[i].toLatin1()); @@ -288,7 +289,6 @@ static char* toRaw(const QString& hex, uint& length) } } else { // big endian uint j=0; - if (hex.length()<=2) return 0; for (int i=2; i