From d78cfb7fbc8764337478b462c1c770db6161ed58 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sat, 24 Jan 2015 20:41:12 +0000 Subject: NewsAggregator: - Fixed memory leaks git-svn-id: http://svn.miranda-ng.org/main/trunk@11901 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewsAggregator/Src/ExportImport.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'plugins/NewsAggregator') diff --git a/plugins/NewsAggregator/Src/ExportImport.cpp b/plugins/NewsAggregator/Src/ExportImport.cpp index a68015e514..9eccb063c5 100644 --- a/plugins/NewsAggregator/Src/ExportImport.cpp +++ b/plugins/NewsAggregator/Src/ExportImport.cpp @@ -46,7 +46,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM HXML hXml = xi.parseFile(FileName, &bytesParsed, NULL); if(hXml != NULL) { HWND hwndList = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - BYTE isTextUTF = 0, isURLUTF = 0, isSiteURLUTF = 0, isGroupUTF = 0; + bool isTextUTF = false, isURLUTF = false, isSiteURLUTF = false, isGroupUTF = false; HXML node = xi.getChildByPath(hXml, _T("opml/body/outline"), 0); if ( !node) node = xi.getChildByPath(hXml, _T("body/outline"), 0); @@ -74,7 +74,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM else if (!xmlUrl && outlineChildsCount) node = xi.getFirstChild(node); else if (xmlUrl) { - TCHAR *text = NULL, *url = NULL, *siteurl = NULL, *group = NULL, *utfgroup = NULL; + TCHAR *text = NULL, *url = NULL, *siteurl = NULL, *group = NULL; BYTE NeedToImport = FALSE; for (int i = 0; i < outlineAttr; i++) { if (!mir_tstrcmpi(xi.getAttrName(node, i), _T("text"))) { @@ -98,23 +98,23 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (!mir_tstrcmpi(xi.getAttrName(node, i), _T("xmlUrl"))) { url = mir_utf8decodeT(_T2A(xi.getAttrValue(node, xi.getAttrName(node, i)))); if ( !url) { - isURLUTF = 0; + isURLUTF = false; url = (TCHAR *)xi.getAttrValue(node, xi.getAttrName(node, i)); } else - isURLUTF = 1; + isURLUTF = true; if (GetContactByURL(url) && NeedToImport) { NeedToImport = FALSE; - DUPES += 1; + DUPES++; } continue; } if (!mir_tstrcmpi(xi.getAttrName(node, i), _T("htmlUrl"))) { siteurl = mir_utf8decodeT(_T2A(xi.getAttrValue(node, xi.getAttrName(node, i)))); if ( !siteurl) { - isSiteURLUTF = 0; + isSiteURLUTF = false; siteurl = (TCHAR *)xi.getAttrValue(node, xi.getAttrName(node, i)); } else - isSiteURLUTF = 1; + isSiteURLUTF = true; continue; } if (text && url && siteurl) @@ -139,10 +139,11 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM parent = xi.getParent(parent); } + TCHAR *utfgroup = NULL; if (group) { utfgroup = mir_utf8decodeT(_T2A(group)); if ( !utfgroup) { - isGroupUTF = 0; + isGroupUTF = false; utfgroup = group; } else isGroupUTF = 1; @@ -175,15 +176,15 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if(!GroupExist) CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)utfgroup); } - if (isTextUTF) - mir_free(text); - if (isURLUTF) - mir_free(url); if (isGroupUTF) mir_free(utfgroup); - if (isSiteURLUTF) - mir_free(siteurl); } + if (isTextUTF) + mir_free(text); + if (isURLUTF) + mir_free(url); + if (isSiteURLUTF) + mir_free(siteurl); HXML tmpnode = node; node = xi.getNextNode(node); -- cgit v1.2.3