James Hawkins : msi: Free the temp buffer if we haven' t assigned it to *appValue.

Alexandre Julliard julliard at winehq.org
Wed Dec 16 09:41:33 CST 2009


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

Author: James Hawkins <truiken at gmail.com>
Date:   Tue Dec 15 18:19:31 2009 -0800

msi: Free the temp buffer if we haven't assigned it to *appValue.

---

 dlls/msi/appsearch.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/msi/appsearch.c b/dlls/msi/appsearch.c
index 95daabb..b99b4f5 100644
--- a/dlls/msi/appsearch.c
+++ b/dlls/msi/appsearch.c
@@ -739,6 +739,7 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
     size_t dirLen = lstrlenW(dir), fileLen = lstrlenW(sig->File);
     WCHAR subpath[MAX_PATH];
     WCHAR *buf;
+    DWORD len;
 
     static const WCHAR starDotStarW[] = { '*','.','*',0 };
 
@@ -753,7 +754,8 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
      * here.  Add two because we might need to add a backslash if the dir name
      * isn't backslash-terminated.
      */
-    buf = msi_alloc( (dirLen + max(fileLen, strlenW(starDotStarW)) + 2) * sizeof(WCHAR));
+    len = dirLen + max(fileLen, strlenW(starDotStarW)) + 2;
+    buf = msi_alloc(len * sizeof(WCHAR));
     if (!buf)
         return ERROR_OUTOFMEMORY;
 
@@ -815,7 +817,7 @@ static UINT ACTION_RecurseSearchDirectory(MSIPACKAGE *package, LPWSTR *appValue,
         }
     }
 
-    if (!*appValue)
+    if (*appValue != buf)
         msi_free(buf);
 
     return rc;




More information about the wine-cvs mailing list