advapi32: Do not call MIDL_user_free() with pointer to stack memory.

This commit is contained in:
Andrew Talbot 2008-04-05 23:46:41 +01:00 committed by Alexandre Julliard
parent 8a18e0e43a
commit 2ae8e87616
2 changed files with 12 additions and 8 deletions

View File

@ -1352,15 +1352,19 @@ done:
static DWORD move_string_to_buffer(BYTE **buf, LPWSTR *string_ptr)
{
DWORD cb;
WCHAR empty_str[] = {0};
if (!*string_ptr)
*string_ptr = empty_str;
{
cb = sizeof(WCHAR);
memset(*buf, 0, cb);
}
else
{
cb = (strlenW(*string_ptr) + 1)*sizeof(WCHAR);
memcpy(*buf, *string_ptr, cb);
MIDL_user_free(*string_ptr);
}
cb = (strlenW(*string_ptr) + 1)*sizeof(WCHAR);
memcpy(*buf, *string_ptr, cb);
MIDL_user_free(*string_ptr);
*string_ptr = (LPWSTR)*buf;
*buf += cb;

View File

@ -857,12 +857,12 @@ static void test_sequence(void)
SetLastError(0xdeadbeef);
ret = QueryServiceConfigA(svc_handle, config, given, &needed);
ok(ret, "Expected success\n");
todo_wine
{
ok(GetLastError() == ERROR_SUCCESS /* W2K3 */||
GetLastError() == 0xdeadbeef /* NT4, XP, Vista */ ||
GetLastError() == ERROR_IO_PENDING /* W2K */,
"Expected ERROR_SUCCESS, ERROR_IO_PENDING or 0xdeadbeef, got %d\n", GetLastError());
todo_wine
{
ok(given == needed, "Expected the given (%d) and needed (%d) buffersizes to be equal\n", given, needed);
}
ok(config->lpBinaryPathName && config->lpLoadOrderGroup && config->lpDependencies && config->lpServiceStartName &&