[CMD]
authorPierre Schweitzer <pierre@reactos.org>
Tue, 15 Sep 2015 11:14:58 +0000 (11:14 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Tue, 15 Sep 2015 11:14:58 +0000 (11:14 +0000)
- Fix a broken check
- Plug a memory leak

svn path=/trunk/; revision=69241

reactos/base/shell/cmd/replace.c

index 9f19d74..0b7ef3f 100644 (file)
@@ -100,9 +100,10 @@ INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *d
             hFileDest = CreateFile(dest, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
                 0, NULL);
 
-            if (hFileSrc == INVALID_HANDLE_VALUE)
+            if (hFileDest == INVALID_HANDLE_VALUE)
             {
                 ConOutResPrintf(STRING_COPY_ERROR1, dest);
+                CloseHandle (hFileSrc);
                 return 0;
             }