aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2017-10-20 10:51:04 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2017-10-20 10:25:16 +0000
commitc23e3761a550ca5e44cb3878fa47d7c00f469424 (patch)
tree22eb65bc95bab2371ae189c8f7687f8ee71eb65b
parent0a6c51e4a0319ca62fb41664da4eac7482844227 (diff)
file_util.c: do not leak service handle
Follow-up of gd64c30052 Change-Id: I620b3fb44fe3090120f2d29809961623e00d55a4 Reviewed-on: https://code.wireshark.org/review/23999 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
-rw-r--r--wsutil/.editorconfig3
-rw-r--r--wsutil/file_util.c6
2 files changed, 4 insertions, 5 deletions
diff --git a/wsutil/.editorconfig b/wsutil/.editorconfig
index f7f11b6..aed2ea1 100644
--- a/wsutil/.editorconfig
+++ b/wsutil/.editorconfig
@@ -53,9 +53,6 @@ indent_size = tab
indent_style = tab
indent_size = tab
-[file_util.[ch]]
-indent_size = 6
-
[g711.[ch]]
indent_style = tab
indent_size = tab
diff --git a/wsutil/file_util.c b/wsutil/file_util.c
index 72ed16d..df3b543 100644
--- a/wsutil/file_util.c
+++ b/wsutil/file_util.c
@@ -508,7 +508,7 @@ ws_init_dll_search_path()
wchar_t *program_path_w;
wchar_t npcap_path_w[MAX_PATH];
unsigned int retval;
- SC_HANDLE h_scm;
+ SC_HANDLE h_scm, h_serv;
typedef BOOL (WINAPI *SetDllDirectoryHandler)(LPCTSTR);
SetDllDirectoryHandler PSetDllDirectory;
@@ -520,7 +520,9 @@ ws_init_dll_search_path()
/* Do not systematically add Npcap path as long as we favor WinPcap over Npcap. */
h_scm = OpenSCManager(NULL, NULL, 0);
if (h_scm) {
- if (OpenService(h_scm, _T("npf"), SC_MANAGER_CONNECT|SERVICE_QUERY_STATUS)) {
+ h_serv = OpenService(h_scm, _T("npf"), SC_MANAGER_CONNECT|SERVICE_QUERY_STATUS);
+ if (h_serv) {
+ CloseServiceHandle(h_serv);
npf_found = TRUE;
}
CloseServiceHandle(h_scm);