Alexandre Julliard : cabinet: Fixed fd leak in case of error.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Feb 14 09:25:42 CST 2007


Module: wine
Branch: master
Commit: a71a22c579282dfc2e95dff07428c22f6891e774
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a71a22c579282dfc2e95dff07428c22f6891e774

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Feb 14 13:12:32 2007 +0100

cabinet: Fixed fd leak in case of error.

---

 dlls/cabinet/fdi.c       |    5 ++++-
 dlls/msi/tests/install.c |    4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/cabinet/fdi.c b/dlls/cabinet/fdi.c
index 8e8120d..93b0ad2 100644
--- a/dlls/cabinet/fdi.c
+++ b/dlls/cabinet/fdi.c
@@ -2446,7 +2446,7 @@ BOOL __cdecl FDICopy(
 { 
   FDICABINETINFO    fdici;
   FDINOTIFICATION   fdin;
-  int               cabhf, filehf, idx;
+  int               cabhf, filehf = 0, idx;
   unsigned int      i;
   char              fullpath[MAX_PATH];
   size_t            pathlen, filenamelen;
@@ -2826,6 +2826,7 @@ BOOL __cdecl FDICopy(
       fdin.time = file->time;
       fdin.attribs = file->attribs; /* FIXME: filter _A_EXEC? */
       ((*pfnfdin)(fdintCLOSE_FILE_INFO, &fdin));
+      filehf = 0;
 
       switch (err) {
         case DECR_OK:
@@ -2914,6 +2915,8 @@ BOOL __cdecl FDICopy(
     break;
   }
 
+  if (filehf) PFDI_CLOSE(hfdi, filehf);
+
   while (decomp_state) {
     fdi_decomp_state *prev_fds;
 
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index d460c40..3bea451 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -1111,10 +1111,10 @@ static void test_uiLevelFlags(void)
     todo_wine
     {
         ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
-        ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
         ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
     }
-    delete_pf("msitest", FALSE);
+    ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
+    ok(delete_pf("msitest", FALSE), "File not installed\n");
 
     delete_cab_files();
     DeleteFile(msifile);




More information about the wine-cvs mailing list