Module: wine Branch: master Commit: 1d3f679ef1bdff2f811a57bb8e8e7be173f342fe URL: http://source.winehq.org/git/wine.git/?a=commit;h=1d3f679ef1bdff2f811a57bb8e...
Author: Frédéric Delanoy frederic.delanoy@gmail.com Date: Tue Oct 30 17:31:28 2012 +0100
cmd: Avoid handle leaks (coverity).
---
programs/cmd/builtins.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index e567bb6..b3fd422 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -394,6 +394,7 @@ static BOOL WCMD_AppendEOF(WCHAR *filename) SetFilePointer (h, 0, NULL, FILE_END); if (!WriteFile(h, &eof, 1, NULL, NULL)) { WINE_ERR("Failed to append EOF to %s (%d)\n", wine_dbgstr_w(filename), GetLastError()); + CloseHandle(h); return FALSE; } CloseHandle(h); @@ -430,6 +431,7 @@ static BOOL WCMD_ManualCopy(WCHAR *srcname, WCHAR *dstname, BOOL ascii, BOOL app append?OPEN_EXISTING:CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (out == NULL) { WINE_ERR("Failed to open %s (%d)\n", wine_dbgstr_w(dstname), GetLastError()); + CloseHandle(in); return FALSE; }