summaryrefslogtreecommitdiff
path: root/src/modules/plugins
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2014-12-16 13:11:12 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2014-12-16 13:11:12 +0000
commitea3ab8f3a8ed69436d3350ac15593394fc7e0e56 (patch)
tree57b3c8a186ddea51ad45fb3976a59e0abe90099b /src/modules/plugins
parent55b2e3d64ab23960caa25fb2a296d44caf39057e (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/plugins')
-rw-r--r--src/modules/plugins/newplugins.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp
index 2e2885033e..70fcb8ca4d 100644
--- a/src/modules/plugins/newplugins.cpp
+++ b/src/modules/plugins/newplugins.cpp
@@ -246,9 +246,7 @@ static int checkPI(BASIC_PLUGIN_INFO* bpi, PLUGININFOEX* pi)
int checkAPI(TCHAR* plugin, BASIC_PLUGIN_INFO* bpi, DWORD mirandaVersion, int checkTypeAPI)
{
- HINSTANCE h = NULL;
-
- h = LoadLibrary(plugin);
+ HINSTANCE h = LoadLibrary(plugin);
if (h == NULL)
return 0;
@@ -283,16 +281,15 @@ LBL_Ok:
bpi->hInst = h;
return 1;
}
-
// check clist ?
- if (checkTypeAPI == CHECKAPI_CLIST) {
+ else if (checkTypeAPI == CHECKAPI_CLIST) {
bpi->clistlink = (CList_Initialise)GetProcAddress(h, "CListInitialise");
if (pi->flags & UNICODE_AWARE)
if (bpi->clistlink)
goto LBL_Ok;
}
-
- goto LBL_Error;
+ else
+ goto LBL_Error;
}
// perform any API related tasks to freeing
@@ -310,11 +307,12 @@ void Plugin_Uninit(pluginEntry *p)
// we need to kill all resources which belong to that DLL before calling FreeLibrary
KillModuleEventHooks(hInst);
KillModuleServices(hInst);
+ UnregisterModule(hInst);
FreeLibrary(hInst);
memset(&p->bpi, 0, sizeof(p->bpi));
}
- UnregisterModule(hInst);
+
if (p == pluginList_crshdmp)
pluginList_crshdmp = NULL;
pluginList.remove(p);
@@ -382,18 +380,18 @@ void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam)
// create the search filter
TCHAR search[MAX_PATH];
mir_sntprintf(search, SIZEOF(search), _T("%s\\Plugins\\*.dll"), exe);
- {
- // FFFN will return filenames for things like dot dll+ or dot dllx
- WIN32_FIND_DATA ffd;
- HANDLE hFind = FindFirstFile(search, &ffd);
- if (hFind != INVALID_HANDLE_VALUE) {
- do {
- if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && valid_library_name(ffd.cFileName))
- cb(&ffd, exe, wParam, lParam);
- } while (FindNextFile(hFind, &ffd));
- FindClose(hFind);
- } //if
- }
+
+ // FFFN will return filenames for things like dot dll+ or dot dllx
+ WIN32_FIND_DATA ffd;
+ HANDLE hFind = FindFirstFile(search, &ffd);
+ if (hFind == INVALID_HANDLE_VALUE)
+ return;
+
+ do {
+ if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && valid_library_name(ffd.cFileName))
+ cb(&ffd, exe, wParam, lParam);
+ } while (FindNextFile(hFind, &ffd));
+ FindClose(hFind);
}
pluginEntry* OpenPlugin(TCHAR *tszFileName, TCHAR *dir, TCHAR *path)