region: Avoid possible memory corruption

pixman_region32_copy assume that destination (first argument)
is initialized and can use a pointer inside based on different
conditions.
As intersection is not initialized this can cause different
memory problems.
This resulted in memory leak detection from address sanitizer.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
This commit is contained in:
Frediano Ziglio 2017-02-28 14:53:11 +00:00
parent ab7cae45bc
commit 4423ea5d2a

View File

@ -452,6 +452,7 @@ void region_xor(QRegion *rgn, const QRegion *other_rgn)
{
pixman_region32_t intersection;
pixman_region32_init(&intersection);
pixman_region32_copy(&intersection, rgn);
pixman_region32_intersect(&intersection,
&intersection,