Commit 25a66632 authored by Peter Berg Larsen's avatar Peter Berg Larsen Committed by Alexandre Julliard

Assorted memleak fixes. Found on Michael Stefaniuc smatch list.

parent dcab706f
......@@ -625,11 +625,11 @@ DWORD WINAPI FormatMessage16(
from = HeapAlloc( GetProcessHeap(), 0, strlen(source)+1 );
strcpy( from, source );
}
if (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM) {
else if (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM) {
from = HeapAlloc( GetProcessHeap(),0,200 );
sprintf(from,"Systemmessage, messageid = 0x%08x\n",dwMessageId);
}
if (dwFlags & FORMAT_MESSAGE_FROM_HMODULE) {
else if (dwFlags & FORMAT_MESSAGE_FROM_HMODULE) {
INT16 bufsize;
HINSTANCE16 hinst16 = ((HINSTANCE16)lpSource & 0xffff);
......
......@@ -1435,13 +1435,18 @@ static BOOL unpack_dde_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM
TRACE( "recv ddepack %u %x\n", size, uiHi );
if (size)
{
hMem = GlobalAlloc( GMEM_MOVEABLE|GMEM_DDESHARE, size );
if (hMem && (ptr = GlobalLock( hMem )))
if (!(hMem = GlobalAlloc( GMEM_MOVEABLE|GMEM_DDESHARE, size )))
return FALSE;
if ((ptr = GlobalLock( hMem )))
{
memcpy( ptr, *buffer, size );
GlobalUnlock( hMem );
}
else return FALSE;
else
{
GlobalFree( hMem );
return FALSE;
}
}
uiLo = (UINT)hMem;
......@@ -1451,8 +1456,8 @@ static BOOL unpack_dde_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM
if (size)
{
if (!buffer || !*buffer) return FALSE;
hMem = GlobalAlloc( GMEM_MOVEABLE|GMEM_DDESHARE, size );
if (hMem && (ptr = GlobalLock( hMem )))
if (!(hMem = GlobalAlloc( GMEM_MOVEABLE|GMEM_DDESHARE, size ))) return FALSE;
if ((ptr = GlobalLock( hMem )))
{
memcpy( ptr, *buffer, size );
GlobalUnlock( hMem );
......@@ -1462,7 +1467,12 @@ static BOOL unpack_dde_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM
GlobalFree( hMem );
return FALSE;
}
}
}
else
{
GlobalFree( hMem );
return FALSE;
}
} else return FALSE;
*lparam = (LPARAM)hMem;
break;
......
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