Skip to content

Commit

Permalink
[codec] fixed region16_union_rect
Browse files Browse the repository at this point in the history
* If source and destination are equal, free the buffer on destination to
  avoid compiler warnings.
* Remove assert that is not required
  • Loading branch information
akallabeth committed Nov 22, 2022
1 parent d03f230 commit 646ecd3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions libfreerdp/codec/region.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@ BOOL region16_union_rect(REGION16* dst, const REGION16* src, const RECTANGLE_16*
UINT32 usedRects, srcNbRects;
UINT16 topInterBand;
WINPR_ASSERT(src);
WINPR_ASSERT(src->data);
WINPR_ASSERT(dst);
srcExtents = region16_extents(src);
dstExtents = region16_extents_noconst(dst);
Expand Down Expand Up @@ -658,8 +657,8 @@ BOOL region16_union_rect(REGION16* dst, const REGION16* src, const RECTANGLE_16*
dstRect++;
}

if ((src == dst) && (src->data->size > 0) && (src->data != &empty_region))
free(src->data);
if ((src == dst) && (dst->data != &empty_region))
free(dst->data);

dstExtents->top = MIN(rect->top, srcExtents->top);
dstExtents->left = MIN(rect->left, srcExtents->left);
Expand All @@ -673,10 +672,7 @@ BOOL region16_union_rect(REGION16* dst, const REGION16* src, const RECTANGLE_16*
dst->data = newItems;

if (!dst->data)
{
free(newItems);
return FALSE;
}

dst->data->nbRects = usedRects;
return region16_simplify_bands(dst);
Expand Down

0 comments on commit 646ecd3

Please sign in to comment.