summaryrefslogtreecommitdiff
path: root/plugins/SpellChecker/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-04-14 16:50:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-04-14 16:50:17 +0000
commit657e6203b0435e74d91d1e756eb55dd9729f447e (patch)
treed8f44264bc6d2b97cf3f9ae118f65346b60a7fd1 /plugins/SpellChecker/src
parent236c95160975b48583e4527601de6beea9e84891 (diff)
minor memor leak fixed
git-svn-id: http://svn.miranda-ng.org/main/trunk@12819 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SpellChecker/src')
-rw-r--r--plugins/SpellChecker/src/RichEdit.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/plugins/SpellChecker/src/RichEdit.cpp b/plugins/SpellChecker/src/RichEdit.cpp
index 1dca488f08..8b37bcedd9 100644
--- a/plugins/SpellChecker/src/RichEdit.cpp
+++ b/plugins/SpellChecker/src/RichEdit.cpp
@@ -6,7 +6,7 @@
DEFINE_GUIDXXX(IID_ITextDocument,0x8CC497C0,0xA1DF,0x11CE,0x80,0x98,0x00,0xAA,0x00,0x47,0xBE,0x5D);
-RichEdit::RichEdit(HWND hwnd)
+RichEdit::RichEdit(HWND hwnd)
: hwnd(NULL), ole(NULL), textDocument(NULL), stopped(0), undoEnabled(TRUE)
{
SetHWND(hwnd);
@@ -105,7 +105,7 @@ void RichEdit::Start()
stopped = 0;
return;
}
- else if (stopped > 0)
+ if (stopped > 0)
return;
if (inverse) {
@@ -189,7 +189,7 @@ int RichEdit::GetTextLength() const
return GetWindowTextLength(hwnd);
}
-TCHAR *RichEdit::GetText(int start, int end) const
+TCHAR* RichEdit::GetText(int start, int end) const
{
if (end <= start)
end = GetTextLength();
@@ -200,18 +200,17 @@ TCHAR *RichEdit::GetText(int start, int end) const
return mir_tstrdup(_T(""));
BSTR text = NULL;
- if (range->GetText(&text) != S_OK || text == NULL) {
+ if (FAILED(range->GetText(&text))) {
+ if (text)
+ ::SysFreeString(text);
range->Release();
return mir_tstrdup(_T(""));
}
- TCHAR *ret = mir_u2t(text);
-
- SysFreeString(text);
-
+ TCHAR *res = mir_u2t(text);
range->Release();
-
- return ret;
+ ::SysFreeString(text);
+ return res;
}
int len = (GetTextLength() + 1);