[Libreoffice-commits] core.git: dbaccess/Executable_odbcconfig.mk dbaccess/win32
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Sep 7 09:44:33 UTC 2018
dbaccess/Executable_odbcconfig.mk | 4 ++++
dbaccess/win32/source/odbcconfig/odbcconfig.cxx | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
New commits:
commit 58008a0fdd611bb75e4f6922483818ffd2acbc26
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Sep 7 07:19:30 2018 +0200
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Sep 7 11:44:09 2018 +0200
Cppcheck: resource leak warning
Change-Id: I855097279cd091c1e8bd665bb0b48ce9279a9ca8
Reviewed-on: https://gerrit.libreoffice.org/60121
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/dbaccess/Executable_odbcconfig.mk b/dbaccess/Executable_odbcconfig.mk
index ea37824924cd..fdfcbf26f434 100644
--- a/dbaccess/Executable_odbcconfig.mk
+++ b/dbaccess/Executable_odbcconfig.mk
@@ -11,6 +11,10 @@ $(eval $(call gb_Executable_Executable,odbcconfig))
$(eval $(call gb_Executable_set_targettype_gui,odbcconfig,YES))
+$(eval $(call gb_Executable_use_libraries,odbcconfig,\
+ comphelper \
+))
+
$(eval $(call gb_Library_use_sdk_api,odbcconfig))
$(eval $(call gb_Executable_add_exception_objects,odbcconfig,\
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;
}
More information about the Libreoffice-commits
mailing list