mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
fixed memory leak in REGION_XorRegion()
svn path=/trunk/; revision=6117
This commit is contained in:
parent
0b9c284361
commit
3ec27cec15
1 changed files with 31 additions and 27 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: region.c,v 1.36 2003/09/09 09:39:21 gvg Exp $ */
|
/* $Id: region.c,v 1.37 2003/09/23 19:33:29 weiden Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
@ -1329,36 +1329,40 @@ static void FASTCALL REGION_SubtractRegion(ROSRGNDATA *regD, ROSRGNDATA *regM,
|
||||||
static void FASTCALL REGION_XorRegion(ROSRGNDATA *dr, ROSRGNDATA *sra,
|
static void FASTCALL REGION_XorRegion(ROSRGNDATA *dr, ROSRGNDATA *sra,
|
||||||
ROSRGNDATA *srb)
|
ROSRGNDATA *srb)
|
||||||
{
|
{
|
||||||
HRGN htra, htrb;
|
HRGN htra, htrb;
|
||||||
ROSRGNDATA *tra, *trb;
|
ROSRGNDATA *tra, *trb;
|
||||||
|
|
||||||
if ((! (htra = RGNDATA_AllocRgn(sra->rdh.nCount + 1))) ||
|
|
||||||
(! (htrb = RGNDATA_AllocRgn(srb->rdh.nCount + 1))))
|
|
||||||
return;
|
|
||||||
tra = RGNDATA_LockRgn( htra );
|
|
||||||
if( !tra ){
|
|
||||||
NtGdiDeleteObject( htra );
|
|
||||||
NtGdiDeleteObject( htrb );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
trb = RGNDATA_LockRgn( htrb );
|
|
||||||
if( !trb ){
|
|
||||||
RGNDATA_UnlockRgn( htra );
|
|
||||||
NtGdiDeleteObject( htra );
|
|
||||||
NtGdiDeleteObject( htrb );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
REGION_SubtractRegion(tra,sra,srb);
|
|
||||||
REGION_SubtractRegion(trb,srb,sra);
|
|
||||||
REGION_UnionRegion(dr,tra,trb);
|
|
||||||
RGNDATA_UnlockRgn( htra );
|
|
||||||
RGNDATA_UnlockRgn( htrb );
|
|
||||||
|
|
||||||
|
if(!(htra = RGNDATA_AllocRgn(sra->rdh.nCount + 1)))
|
||||||
|
return;
|
||||||
|
if(!(htrb = RGNDATA_AllocRgn(srb->rdh.nCount + 1)))
|
||||||
|
{
|
||||||
|
NtGdiDeleteObject( htra );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tra = RGNDATA_LockRgn( htra );
|
||||||
|
if(!tra ){
|
||||||
NtGdiDeleteObject( htra );
|
NtGdiDeleteObject( htra );
|
||||||
NtGdiDeleteObject( htrb );
|
NtGdiDeleteObject( htrb );
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
trb = RGNDATA_LockRgn( htrb );
|
||||||
|
if( !trb ){
|
||||||
|
RGNDATA_UnlockRgn( htra );
|
||||||
|
NtGdiDeleteObject( htra );
|
||||||
|
NtGdiDeleteObject( htrb );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
REGION_SubtractRegion(tra,sra,srb);
|
||||||
|
REGION_SubtractRegion(trb,srb,sra);
|
||||||
|
REGION_UnionRegion(dr,tra,trb);
|
||||||
|
RGNDATA_UnlockRgn( htra );
|
||||||
|
RGNDATA_UnlockRgn( htrb );
|
||||||
|
|
||||||
|
NtGdiDeleteObject( htra );
|
||||||
|
NtGdiDeleteObject( htrb );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue