From 9626e6e8e7d33a53b58785233290f400b63e8825 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Wed, 21 Jan 2015 21:21:11 +0000 Subject: Variables: -Minor leaks fixed git-svn-id: http://svn.miranda-ng.org/main/trunk@11892 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Variables/src/parse_miranda.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'plugins/Variables/src/parse_miranda.cpp') 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; } -- cgit v1.2.3