diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-09-07 07:19:30 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-09-07 11:44:09 +0200 |
commit | 58008a0fdd611bb75e4f6922483818ffd2acbc26 (patch) | |
tree | b106d23913899ff069c647a5128cf6f123d7896f /dbaccess/win32 | |
parent | 5dd1474ca627c1354ebd4c22c890e9fd67afcffa (diff) |
Cppcheck: resource leak warning
Change-Id: I855097279cd091c1e8bd665bb0b48ce9279a9ca8
Reviewed-on: https://gerrit.libreoffice.org/60121
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'dbaccess/win32')
-rw-r--r-- | dbaccess/win32/source/odbcconfig/odbcconfig.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/dbaccess/win32/source/odbcconfig/odbcconfig.cxx b/dbaccess/win32/source/odbcconfig/odbcconfig.cxx index f9add1bef2f1..7874bb4c056f 100644 --- a/dbaccess/win32/source/odbcconfig/odbcconfig.cxx +++ b/dbaccess/win32/source/odbcconfig/odbcconfig.cxx @@ -23,6 +23,7 @@ #endif #include <windows.h> #include <sqlext.h> +#include <comphelper/scopeguard.hxx> // the name of the library which contains the SQLManageDataSources function #define ODBC_UI_LIB_NAME L"ODBCCP32.DLL" @@ -113,6 +114,7 @@ extern "C" int APIENTRY wWinMain( HINSTANCE _hAppInstance, HINSTANCE, LPWSTR, in hModule = LoadLibraryExW( ODBC_UI_LIB_NAME, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH ); if ( hModule == nullptr ) return displayLastError(); + comphelper::ScopeGuard hModuleReleaser([hModule]() { FreeLibrary(hModule); }); FARPROC pManageDSProc = GetProcAddress( hModule, "SQLManageDataSources" ); if ( pManageDSProc == nullptr ) @@ -122,8 +124,6 @@ extern "C" int APIENTRY wWinMain( HINSTANCE _hAppInstance, HINSTANCE, LPWSTR, in if ( !( (*pManageDS)( hAppWindow ) ) ) return displayLastError(); - FreeLibrary( hModule ); - return 0; } |