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

View File

@ -573,7 +573,10 @@ static LPSTR convert_file_list(LPCSTR FileList, DWORD *dwNumFiles)
/* empty list */
if (!lstrlenA(szConvertedList))
{
HeapFree(GetProcessHeap(), 0, szConvertedList);
return NULL;
}
*dwNumFiles = 1;
@ -744,6 +747,19 @@ HRESULT WINAPI ExtractFilesA(LPCSTR CabName, LPCSTR ExpandDir, DWORD Flags,
extractDest.flags |= EXTRACT_EXTRACTFILES;
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:
FreeLibrary(hCabinet);
HeapFree(GetProcessHeap(), 0, szConvertedList);