[PATCH 14/16] Fix memory leak in XXorRegion error path.

Ander Conselvan de Oliveira ander.conselvan-de-oliveira at nokia.com
Wed Mar 30 06:12:07 PDT 2011


Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira at nokia.com>
---
 src/Region.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/Region.c b/src/Region.c
index e960ad1..2350cd3 100644
--- a/src/Region.c
+++ b/src/Region.c
@@ -1449,8 +1449,12 @@ XXorRegion(Region sra, Region srb, Region dr)
 {
     Region tra, trb;
 
-    if ((! (tra = XCreateRegion())) || (! (trb = XCreateRegion())))
+    if (! (tra = XCreateRegion()))
 	return 0;
+    if (! (trb = XCreateRegion())) {
+	XDestroyRegion(tra);
+	return 0;
+    }
     (void) XSubtractRegion(sra,srb,tra);
     (void) XSubtractRegion(srb,sra,trb);
     (void) XUnionRegion(tra,trb,dr);
-- 
1.7.0.4



More information about the xorg-devel mailing list