From d9e1a0f05b30fd646a6b473bea605f6054bf0e67 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 20 Sep 2014 18:58:47 +0200 Subject: 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 Reviewed-by: Gunnar Sletta --- src/gui/painting/qregion.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/gui/painting/qregion.cpp') diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 20c62fdd9d..f1f6a51305 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -3562,8 +3562,10 @@ static QRegionPrivate *PolygonRegion(const QPoint *Pts, int Count, int rule) return region; } - if (!(pETEs = static_cast(malloc(sizeof(EdgeTableEntry) * Count)))) + if (!(pETEs = static_cast(malloc(sizeof(EdgeTableEntry) * Count)))) { + delete region; return 0; + } region->vectorize(); -- cgit v1.2.3