- Fix memory leaks
- Fix null-pointer dereference
- Fix user-after-free

CID #1206908
CID #1206915
CID #1206921
CID #1207022

svn path=/trunk/; revision=63021
This commit is contained in:
Pierre Schweitzer 2014-04-27 18:29:06 +00:00
parent 2f3b278836
commit 55c6df28a8
2 changed files with 9 additions and 4 deletions

View file

@ -179,12 +179,16 @@ EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc)
if (!GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_ILANGUAGE, if (!GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_ILANGUAGE,
szLocale, sizeof(szLocale) / sizeof(WCHAR))) szLocale, sizeof(szLocale) / sizeof(WCHAR)))
{ {
FindClose(hFind);
return FALSE; return FALSE;
} }
hr = StringCbCatW(szSectionLocale, sizeof(szSectionLocale), szLocale); hr = StringCbCatW(szSectionLocale, sizeof(szSectionLocale), szLocale);
if (FAILED(hr)) if (FAILED(hr))
{
FindClose(hFind);
return FALSE; return FALSE;
}
#define GET_STRING1(a, b) \ #define GET_STRING1(a, b) \
if (!ParserGetString(szSectionLocale, a, b, MAX_PATH, FindFileData.cFileName)) \ if (!ParserGetString(szSectionLocale, a, b, MAX_PATH, FindFileData.cFileName)) \

View file

@ -205,7 +205,7 @@ static
DWORD WINAPI DWORD WINAPI
ThreadFunc(LPVOID Context) ThreadFunc(LPVOID Context)
{ {
IBindStatusCallback *dl; IBindStatusCallback *dl = NULL;
WCHAR path[MAX_PATH]; WCHAR path[MAX_PATH];
LPWSTR p; LPWSTR p;
HWND Dlg = (HWND) Context; HWND Dlg = (HWND) Context;
@ -262,6 +262,7 @@ ThreadFunc(LPVOID Context)
/* download it */ /* download it */
bTempfile = TRUE; bTempfile = TRUE;
dl = CreateDl(Context, &bCancelled); dl = CreateDl(Context, &bCancelled);
if (dl == NULL) goto end;
hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
if (!hOpen) goto end; if (!hOpen) goto end;
@ -283,8 +284,6 @@ ThreadFunc(LPVOID Context)
} }
while (dwBytesRead); while (dwBytesRead);
CloseHandle(hOut);
if (dl) IBindStatusCallback_Release(dl);
if (bCancelled) goto end; if (bCancelled) goto end;
ShowWindow(Dlg, SW_HIDE); ShowWindow(Dlg, SW_HIDE);
@ -299,6 +298,8 @@ end:
InternetCloseHandle(hFile); InternetCloseHandle(hFile);
InternetCloseHandle(hOpen); InternetCloseHandle(hOpen);
if (dl) IBindStatusCallback_Release(dl);
if (bTempfile) if (bTempfile)
{ {
if (bCancelled || (SettingsInfo.bDelInstaller && !bCab)) if (bCancelled || (SettingsInfo.bDelInstaller && !bCab))