mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:53:07 +00:00
Fix memory leak in POLYGONFILL_MakeEdgeList when it fail.
svn path=/trunk/; revision=20416
This commit is contained in:
parent
262b201ee2
commit
5080674b38
1 changed files with 20 additions and 1 deletions
|
@ -266,6 +266,7 @@ POLYGONFILL_MakeEdgeList(PPOINT Points, int Count)
|
||||||
list->Edges = (FILL_EDGE**)EngAllocMem(FL_ZERO_MEMORY, Count*sizeof(FILL_EDGE*), FILL_EDGE_ALLOC_TAG);
|
list->Edges = (FILL_EDGE**)EngAllocMem(FL_ZERO_MEMORY, Count*sizeof(FILL_EDGE*), FILL_EDGE_ALLOC_TAG);
|
||||||
if ( !list->Edges )
|
if ( !list->Edges )
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
memset ( list->Edges, 0, Count * sizeof(FILL_EDGE*) );
|
memset ( list->Edges, 0, Count * sizeof(FILL_EDGE*) );
|
||||||
|
|
||||||
for ( CurPt = 1; CurPt < Count; ++CurPt )
|
for ( CurPt = 1; CurPt < Count; ++CurPt )
|
||||||
|
@ -273,6 +274,7 @@ POLYGONFILL_MakeEdgeList(PPOINT Points, int Count)
|
||||||
e = POLYGONFILL_MakeEdge ( Points[CurPt-1], Points[CurPt] );
|
e = POLYGONFILL_MakeEdge ( Points[CurPt-1], Points[CurPt] );
|
||||||
if ( !e )
|
if ( !e )
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
// if a straight horizontal line - who cares?
|
// if a straight horizontal line - who cares?
|
||||||
if ( !e->absdy )
|
if ( !e->absdy )
|
||||||
EngFreeMem ( e );
|
EngFreeMem ( e );
|
||||||
|
@ -282,6 +284,7 @@ POLYGONFILL_MakeEdgeList(PPOINT Points, int Count)
|
||||||
e = POLYGONFILL_MakeEdge ( Points[CurPt-1], Points[0] );
|
e = POLYGONFILL_MakeEdge ( Points[CurPt-1], Points[0] );
|
||||||
if ( !e )
|
if ( !e )
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if ( !e->absdy )
|
if ( !e->absdy )
|
||||||
EngFreeMem ( e );
|
EngFreeMem ( e );
|
||||||
else
|
else
|
||||||
|
@ -289,6 +292,22 @@ POLYGONFILL_MakeEdgeList(PPOINT Points, int Count)
|
||||||
return list;
|
return list;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
if (list != NULL)
|
||||||
|
{
|
||||||
|
EngFreeMem(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (list->Edges != NULL)
|
||||||
|
{
|
||||||
|
int t;
|
||||||
|
for (t=0; Count;t++)
|
||||||
|
{
|
||||||
|
if (list->Edges[t] != NULL)
|
||||||
|
EngFreeMem(list->Edges[t]);
|
||||||
|
}
|
||||||
|
EngFreeMem(list->Edges);
|
||||||
|
}
|
||||||
|
|
||||||
DPRINT1("Out Of MEMORY!!\n");
|
DPRINT1("Out Of MEMORY!!\n");
|
||||||
POLYGONFILL_DestroyEdgeList ( list );
|
POLYGONFILL_DestroyEdgeList ( list );
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue