Skip to content

Commit

Permalink
Coverity: Fix 3 resource leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco van Wieringen committed Nov 10, 2015
1 parent d511f6e commit 9848e50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/win32/compat/compat.c
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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);

Expand Down
1 change: 1 addition & 0 deletions src/win32/generic/service.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit 9848e50

Please sign in to comment.