From 9025c9444dfc45add9ff906ddd7808999b3752ae Mon Sep 17 00:00:00 2001 From: Satya Date: Thu, 14 Mar 2019 16:27:12 +0530 Subject: [PATCH] Fix memory leak Free memory allocated to temp before returning from the function. --- src/CalcViewModel/StandardCalculatorViewModel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CalcViewModel/StandardCalculatorViewModel.cpp b/src/CalcViewModel/StandardCalculatorViewModel.cpp index a25aeb18..737c7a06 100644 --- a/src/CalcViewModel/StandardCalculatorViewModel.cpp +++ b/src/CalcViewModel/StandardCalculatorViewModel.cpp @@ -525,6 +525,7 @@ void StandardCalculatorViewModel::HandleUpdatedOperandData(Command cmdenum) length = m_selectedExpressionLastData->Length() + 1; if (length > 50) { + delete [] temp; return; } for (; i < length; ++i)