summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-01-21 21:21:11 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-01-21 21:21:11 +0000
commit9626e6e8e7d33a53b58785233290f400b63e8825 (patch)
tree432d3e4dcf8bf13fcdb996448b73c88ef06ce706
parent8011e6b019517dbaea7cc31f856230957a1009cf (diff)
Variables:
-Minor leaks fixed git-svn-id: http://svn.miranda-ng.org/main/trunk@11892 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Variables/src/parse_miranda.cpp21
-rw-r--r--plugins/Variables/src/parse_system.cpp4
2 files changed, 14 insertions, 11 deletions
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp
index d736147d23..23f7c42d79 100644
--- a/plugins/Variables/src/parse_miranda.cpp
+++ b/plugins/Variables/src/parse_miranda.cpp
@@ -226,20 +226,21 @@ static TCHAR* parseDBSetting(ARGUMENTSINFO *ai)
}
}
- TCHAR *res = NULL, *szDefaultValue = NULL;
-
char *szModule = mir_t2a(ai->targv[2]);
- char *szSetting = mir_t2a(ai->targv[3]);
-
- if (ai->argc > 4 && _tcslen(ai->targv[4]) > 0)
- szDefaultValue = mir_tstrdup(ai->targv[4]);
+ if (szModule == NULL)
+ return NULL;
- if (szModule != NULL && szSetting != NULL) {
- res = getDBSetting(hContact, szModule, szSetting, szDefaultValue);
+ char *szSetting = mir_t2a(ai->targv[3]);
+ if (szSetting == NULL) {
mir_free(szModule);
- mir_free(szSetting);
- mir_free(szDefaultValue);
+ return NULL;
}
+
+ TCHAR *szDefaultValue = ((ai->argc > 4 && _tcslen(ai->targv[4]) > 0) ? mir_tstrdup(ai->targv[4]) : NULL);
+ TCHAR *res = getDBSetting(hContact, szModule, szSetting, szDefaultValue);
+ mir_free(szDefaultValue);
+ mir_free(szSetting);
+ mir_free(szModule);
return res;
}
diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp
index 1c888e24f1..b17266b807 100644
--- a/plugins/Variables/src/parse_system.cpp
+++ b/plugins/Variables/src/parse_system.cpp
@@ -645,8 +645,10 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai)
}
bufSz = TXTFILEBUFSZ*csz;
pBuf = (PBYTE)mir_calloc(bufSz);
- if (pBuf == NULL)
+ if (pBuf == NULL) {
+ CloseHandle(hFile);
return NULL;
+ }
// count number of lines
do {