advpack: Plug a couple of memory leaks.

This commit is contained in:
Eric Pouech 2006-10-21 08:49:10 +02:00 committed by Alexandre Julliard
parent 2cb378d498
commit ea2f60160c
2 changed files with 21 additions and 4 deletions

View File

@ -710,6 +710,7 @@ HRESULT WINAPI TranslateInfStringW(LPCWSTR pszInfFilename, LPCWSTR pszInstallSec
DWORD dwBufferSize, PDWORD pdwRequiredSize, PVOID pvReserved) DWORD dwBufferSize, PDWORD pdwRequiredSize, PVOID pvReserved)
{ {
HINF hInf; HINF hInf;
HRESULT hret = S_OK;
TRACE("(%s, %s, %s, %s, %p, %d, %p, %p)\n", TRACE("(%s, %s, %s, %s, %p, %d, %p, %p)\n",
debugstr_w(pszInfFilename), debugstr_w(pszInstallSection), debugstr_w(pszInfFilename), debugstr_w(pszInstallSection),
@ -730,13 +731,13 @@ HRESULT WINAPI TranslateInfStringW(LPCWSTR pszInfFilename, LPCWSTR pszInstallSec
pszBuffer, dwBufferSize, pdwRequiredSize)) pszBuffer, dwBufferSize, pdwRequiredSize))
{ {
if (dwBufferSize < *pdwRequiredSize) if (dwBufferSize < *pdwRequiredSize)
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); hret = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
else
return SPAPI_E_LINE_NOT_FOUND; hret = SPAPI_E_LINE_NOT_FOUND;
} }
SetupCloseInfFile(hInf); SetupCloseInfFile(hInf);
return S_OK; return hret;
} }
/*********************************************************************** /***********************************************************************

View File

@ -573,7 +573,10 @@ static LPSTR convert_file_list(LPCSTR FileList, DWORD *dwNumFiles)
/* empty list */ /* empty list */
if (!lstrlenA(szConvertedList)) if (!lstrlenA(szConvertedList))
{
HeapFree(GetProcessHeap(), 0, szConvertedList);
return NULL; return NULL;
}
*dwNumFiles = 1; *dwNumFiles = 1;
@ -744,6 +747,19 @@ HRESULT WINAPI ExtractFilesA(LPCSTR CabName, LPCSTR ExpandDir, DWORD Flags,
extractDest.flags |= EXTRACT_EXTRACTFILES; extractDest.flags |= EXTRACT_EXTRACTFILES;
res = pExtract(&extractDest, CabName); res = pExtract(&extractDest, CabName);
if (extractDest.filelist)
{
struct ExtractFileList* curr = extractDest.filelist;
struct ExtractFileList* next;
while (curr)
{
next = curr->next;
free_file_node(curr);
curr = next;
}
}
done: done:
FreeLibrary(hCabinet); FreeLibrary(hCabinet);
HeapFree(GetProcessHeap(), 0, szConvertedList); HeapFree(GetProcessHeap(), 0, szConvertedList);