diff --git a/src/win32/compat/compat.c b/src/win32/compat/compat.c index 58d3c2a1cba..724fc5b4f8e 100644 --- a/src/win32/compat/compat.c +++ b/src/win32/compat/compat.c @@ -3317,6 +3317,7 @@ BPIPE *open_bpipe(char *prog, int wait, const char *mode) * Close our write side so when process terminates we can detect eof. */ CloseHandle(hChildStdoutWr); + hChildStdoutWr = INVALID_HANDLE_VALUE; int rfd = _open_osfhandle((intptr_t)hChildStdoutRdDup, O_RDONLY | O_BINARY); if (rfd >= 0) { @@ -3329,6 +3330,7 @@ BPIPE *open_bpipe(char *prog, int wait, const char *mode) * Close our read side so to not interfere with child's copy. */ CloseHandle(hChildStdinRd); + hChildStdinRd = INVALID_HANDLE_VALUE; int wfd = _open_osfhandle((intptr_t)hChildStdinWrDup, O_WRONLY | O_BINARY); if (wfd >= 0) { @@ -3345,7 +3347,9 @@ BPIPE *open_bpipe(char *prog, int wait, const char *mode) cleanup: CloseHandleIfValid(hChildStdoutRd); + CloseHandleIfValid(hChildStdoutWr); CloseHandleIfValid(hChildStdoutRdDup); + CloseHandleIfValid(hChildStdinRd); CloseHandleIfValid(hChildStdinWr); CloseHandleIfValid(hChildStdinWrDup); diff --git a/src/win32/generic/service.c b/src/win32/generic/service.c index 80756d26d39..4093155b234 100644 --- a/src/win32/generic/service.c +++ b/src/win32/generic/service.c @@ -202,6 +202,7 @@ int bareosServiceMain() _("Registry service not found: Bareos service not started"), APP_DESC, MB_OK); log_error_message(_("Registry service entry point not found")); + FreeLibrary(kerneldll); /* free up kernel dll */ return 1; }