QRegion: fix a memory leak

An early return in case of errors leaked memory tracked in a variable
in scope.

Change-Id: I68cd77890608caff54df7476d38850e5541ce76e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
Giuseppe D'Angelo 2014-09-20 18:58:47 +02:00
parent 772b799a83
commit d9e1a0f05b

View File

@ -3562,8 +3562,10 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule)
return region;
}
if (!(pETEs = static_cast<EdgeTableEntry *>(malloc(sizeof(EdgeTableEntry) * Count))))
if (!(pETEs = static_cast<EdgeTableEntry *>(malloc(sizeof(EdgeTableEntry) * Count)))) {
delete region;
return 0;
}
region->vectorize();