From 2cd05c2649104e8690defdcf0122d8c3e827c1d2 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sat, 10 Jan 2015 18:44:06 +0000 Subject: Variables: - Fixed various memory leaks git-svn-id: http://svn.miranda-ng.org/main/trunk@11821 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Variables/src/parse_str.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'plugins/Variables/src/parse_str.cpp') diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp index 28df138d44..0f6cb00b0d 100644 --- a/plugins/Variables/src/parse_str.cpp +++ b/plugins/Variables/src/parse_str.cpp @@ -211,7 +211,7 @@ static TCHAR *parseLineCount(ARGUMENTSINFO *ai) TCHAR *cur = ai->targv[1]; while (cur < (ai->targv[1] + _tcslen(ai->targv[1]))) { if (!_tcsncmp(cur, _T("\r\n"), 2)) { - count += 1; + count++; cur++; } else if (*cur == '\n') @@ -700,13 +700,13 @@ static TCHAR *getNthWord(TCHAR *szString, int w) while (*scur == ' ') scur++; - count += 1; + count++; while ((count < w) && (scur < szString + _tcslen(szString))) { if (*scur == ' ') { while (*scur == ' ') scur++; - count += 1; + count++; } if (count < w) scur++; @@ -751,15 +751,15 @@ static TCHAR *parseWord(ARGUMENTSINFO *ai) return res; if (res != NULL) { - res = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(szWord) + 2)*sizeof(TCHAR)); - if (res != NULL) { + TCHAR *pres = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(szWord) + 2)*sizeof(TCHAR)); + if (pres != NULL) { + res = pres; _tcscat(res, _T(" ")); _tcscat(res, szWord); } + mir_free(szWord); } - else res = mir_tstrdup(szWord); - - mir_free(szWord); + else res = szWord; } return res; -- cgit v1.2.3