Commit 9170cc82 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

Properly resize the buffer based on ERROR_MORE_DATA.

Also remember to free the allocated buffer.
parent 0f394ae6
......@@ -873,9 +873,18 @@ UINT WINAPI MsiEnumComponentQualifiersW( LPWSTR szComponent, DWORD iIndex,
rc = RegEnumValueW(key, iIndex, lpQualifierBuf, pcchQualifierBuf, NULL,
NULL, (LPBYTE)full_buffer, &full_buffer_size);
if (rc == ERROR_MORE_DATA)
{
HeapFree(GetProcessHeap(),0,full_buffer);
full_buffer_size+=sizeof(WCHAR);
full_buffer = HeapAlloc(GetProcessHeap(),0,full_buffer_size);
rc = RegEnumValueW(key, iIndex, lpQualifierBuf, pcchQualifierBuf, NULL,
NULL, (LPBYTE)full_buffer, &full_buffer_size);
}
RegCloseKey(key);
if (rc == ERROR_SUCCESS || rc == ERROR_MORE_DATA)
if (rc == ERROR_SUCCESS)
{
if (lpApplicationDataBuf && pcchApplicationDataBuf)
{
......@@ -898,6 +907,8 @@ UINT WINAPI MsiEnumComponentQualifiersW( LPWSTR szComponent, DWORD iIndex,
debugstr_w(lpApplicationDataBuf));
}
HeapFree(GetProcessHeap(),0,full_buffer);
return rc;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment