Author: fireball
Date: Wed Aug 26 12:56:11 2009
New Revision: 42935
URL:
http://svn.reactos.org/svn/reactos?rev=42935&view=rev
Log:
- Own the bitmap before freeing it, fixes a crash when trying to free a global bitmap.
- Don't free NULL pointers.
Modified:
branches/arwinss/reactos/subsystems/win32/win32k/gre/surfobj.c
branches/arwinss/reactos/subsystems/win32/win32k/wine/hook.c
branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/surfobj.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gre/surfobj.c [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gre/surfobj.c [iso-8859-1] Wed Aug 26
12:56:11 2009
@@ -226,6 +226,10 @@
VOID FASTCALL
GreDeleteBitmap(HGDIOBJ hBitmap)
{
+ /* Get ownership */
+ GDIOBJ_SetOwnership(hBitmap, PsGetCurrentProcess());
+
+ /* Free it */
GDIOBJ_FreeObjByHandle(hBitmap, GDI_OBJECT_TYPE_BITMAP);
}
Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/hook.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/wine/hook.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/hook.c [iso-8859-1] Wed Aug 26
12:56:11 2009
@@ -145,7 +145,7 @@
static void free_hook( struct hook *hook )
{
free_user_handle( hook->handle );
- ExFreePool( hook->module );
+ if (hook->module) ExFreePool( hook->module );
if (hook->thread)
{
assert( hook->thread->desktop_users > 0 );
Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c [iso-8859-1] Wed Aug 26
12:56:11 2009
@@ -1701,7 +1701,7 @@
if (win->win_region) free_region( win->win_region );
if (win->update_region) free_region( win->update_region );
if (win->class) release_class( win->class );
- ExFreePool( win->text );
+ if (win->text) ExFreePool( win->text );
memset( win, 0x55, sizeof(*win) + win->nb_extra_bytes - 1 );
ExFreePool( win );
}
@@ -1993,7 +1993,7 @@
reply->count = array.count;
len = min( get_reply_max_size((void*)req), array.count * sizeof(user_handle_t) );
if (len) set_reply_data_ptr( (void*)req, array.handles, len );
- else ExFreePool( array.handles );
+ else if (array.handles) ExFreePool( array.handles );
}