diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2014-12-16 13:11:12 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2014-12-16 13:11:12 +0000 |
commit | ea3ab8f3a8ed69436d3350ac15593394fc7e0e56 (patch) | |
tree | 57b3c8a186ddea51ad45fb3976a59e0abe90099b /src/modules/utils | |
parent | 55b2e3d64ab23960caa25fb2a296d44caf39057e (diff) |
Fixed minor leaks
git-svn-id: http://svn.miranda-ng.org/main/trunk@11457 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/utils')
-rw-r--r-- | src/modules/utils/openurl.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/modules/utils/openurl.cpp b/src/modules/utils/openurl.cpp index 7228182874..ab1797e2c5 100644 --- a/src/modules/utils/openurl.cpp +++ b/src/modules/utils/openurl.cpp @@ -34,7 +34,7 @@ typedef struct { static void OpenURLThread(void *arg)
{
TOpenUrlInfo *hUrlInfo = (TOpenUrlInfo*)arg;
- if (!hUrlInfo->szUrl)
+ if (!hUrlInfo || !hUrlInfo->szUrl)
return;
//wack a protocol on it
@@ -47,20 +47,18 @@ static void OpenURLThread(void *arg) int i;
for (i=0; _istalpha(hUrlInfo->szUrl[i]); i++);
if (hUrlInfo->szUrl[i] == ':')
- szResult = mir_tstrdup(hUrlInfo->szUrl);
- else {
- if (!_tcsnicmp(hUrlInfo->szUrl, _T("ftp."), 4))
- mir_sntprintf(szResult, size, _T("ftp://%s"), hUrlInfo->szUrl);
- else
- mir_sntprintf(szResult, size, _T("http://%s"), hUrlInfo->szUrl);
- }
+ mir_tstrcpy(szResult, hUrlInfo->szUrl);
+ else if (!_tcsnicmp(hUrlInfo->szUrl, _T("ftp."), 4))
+ mir_sntprintf(szResult, size, _T("ftp://%s"), hUrlInfo->szUrl);
+ else
+ mir_sntprintf(szResult, size, _T("http://%s"), hUrlInfo->szUrl);
}
// check user defined browser for opening urls
- DBVARIANT dbv;
- if (!db_get_ts(NULL, "Miranda", "OpenUrlBrowser", &dbv)) {
- ShellExecute(NULL, _T("open"), dbv.ptszVal, szResult, NULL, (hUrlInfo->newWindow) ? SW_NORMAL : SW_SHOWDEFAULT);
- db_free(&dbv);
+ TCHAR *tszBrowser = db_get_tsa(NULL, "Miranda", "OpenUrlBrowser");
+ if (tszBrowser) {
+ ShellExecute(NULL, _T("open"), tszBrowser, szResult, NULL, (hUrlInfo->newWindow) ? SW_NORMAL : SW_SHOWDEFAULT);
+ mir_free(tszBrowser);
}
else ShellExecute(NULL, _T("open"), szResult, NULL, NULL, (hUrlInfo->newWindow) ? SW_NORMAL : SW_SHOWDEFAULT);
|