diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-01-10 18:44:06 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-01-10 18:44:06 +0000 |
commit | 2cd05c2649104e8690defdcf0122d8c3e827c1d2 (patch) | |
tree | e778d1ebc66f1942eab066d8de5b0a77e612ef5f /plugins/Variables/src/parse_variables.cpp | |
parent | e5972722ef981be64fe46ca8c07c2c403458e255 (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/parse_variables.cpp')
-rw-r--r-- | plugins/Variables/src/parse_variables.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/plugins/Variables/src/parse_variables.cpp b/plugins/Variables/src/parse_variables.cpp index 30136d8068..8a711a1524 100644 --- a/plugins/Variables/src/parse_variables.cpp +++ b/plugins/Variables/src/parse_variables.cpp @@ -37,14 +37,14 @@ static int addToVariablesRegister(TCHAR *szName, TCHAR *szText) return 0;
}
}
- vr = (VARIABLEREGISTER*)mir_realloc(vr, (vrCount + 1)*sizeof(VARIABLEREGISTER));
- if (vr == NULL)
+ VARIABLEREGISTER *pvr = (VARIABLEREGISTER*)mir_realloc(vr, (vrCount + 1)*sizeof(VARIABLEREGISTER));
+ if (pvr == NULL)
return -1;
+ vr = pvr;
vr[vrCount].szName = mir_tstrdup(szName);
vr[vrCount].szText = mir_tstrdup(szText);
- vr[vrCount].dwOwnerThread = GetCurrentThreadId();
- vrCount += 1;
+ vr[vrCount++].dwOwnerThread = GetCurrentThreadId();
return 0;
}
@@ -63,8 +63,6 @@ static TCHAR *searchVariableRegister(TCHAR *szName) static TCHAR *parsePut(ARGUMENTSINFO *ai)
{
- FORMATINFO fi;
-
if (ai->argc != 3)
return NULL;
@@ -72,6 +70,7 @@ static TCHAR *parsePut(ARGUMENTSINFO *ai) if (addToVariablesRegister(ai->targv[1], ai->targv[2]))
return NULL;
+ FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
fi.tszFormat = ai->targv[2];
fi.flags |= FIF_TCHAR;
|