summaryrefslogtreecommitdiff
path: root/plugins/Variables/src/help.cpp
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-01-10 18:44:06 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-01-10 18:44:06 +0000
commit2cd05c2649104e8690defdcf0122d8c3e827c1d2 (patch)
treee778d1ebc66f1942eab066d8de5b0a77e612ef5f /plugins/Variables/src/help.cpp
parente5972722ef981be64fe46ca8c07c2c403458e255 (diff)
Variables:
- Fixed various memory leaks git-svn-id: http://svn.miranda-ng.org/main/trunk@11821 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Variables/src/help.cpp')
-rw-r--r--plugins/Variables/src/help.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp
index fcc86aa69f..ee22d223ac 100644
--- a/plugins/Variables/src/help.cpp
+++ b/plugins/Variables/src/help.cpp
@@ -285,13 +285,9 @@ static TCHAR *getHelpDescription(TOKENREGISTEREX *tr)
static TCHAR *getTokenDescription(TOKENREGISTEREX *tr)
{
- char *args, *first, *second;
-
if (tr == NULL)
return NULL;
- args = NULL;
- TCHAR *tArgs = NULL;
if (tr->szHelpText == NULL)
return mir_tstrdup(tr->tszTokenString);
@@ -300,7 +296,8 @@ static TCHAR *getTokenDescription(TOKENREGISTEREX *tr)
return NULL;
char *cur = helpText;
- first = second = NULL;
+ TCHAR *tArgs = NULL;
+ char *args = NULL, *first = NULL, *second = NULL;
while (*cur != 0) {
if (*cur == '\t') {
if (first == NULL)
@@ -319,8 +316,10 @@ static TCHAR *getTokenDescription(TOKENREGISTEREX *tr)
size_t len = _tcslen(tr->tszTokenString) + (args!=NULL?strlen(args):0) + 3;
TCHAR *desc = (TCHAR*)mir_calloc(len * sizeof(TCHAR));
- if (desc == NULL)
+ if (desc == NULL) {
+ mir_free(helpText);
return NULL;
+ }
if (tr->flags&TRF_FIELD)
mir_sntprintf(desc, len, _T("%c%s%c"), FIELD_CHAR, tr->szTokenString, FIELD_CHAR);
@@ -381,7 +380,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM wPar
HELPDLGDATA *hdd = (HELPDLGDATA *)GetWindowLongPtr(GetParent(hwndDlg), GWLP_USERDATA);
int i = -1;
do {
- i += 1;
+ i++;
tszHelpDesc = tszTokenDesc = NULL;
tr = getTokenRegister(i);
if ((tr == NULL) || (tr->tszTokenString == NULL))