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

This commit is contained in:
James Hawkins 2009-12-15 18:19:31 -08:00 committed by Alexandre Julliard
parent b530f38baa
commit 8ed06175a0
1 changed files with 4 additions and 2 deletions

View File

@ -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;