[PATCH 13/16] Fix memory leak on XShrinkRegion error path.

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


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

diff --git a/src/Region.c b/src/Region.c
index 45a0bda..e960ad1 100644
--- a/src/Region.c
+++ b/src/Region.c
@@ -384,7 +384,8 @@ XShrinkRegion(
     int grow;
 
     if (!dx && !dy) return 0;
-    if ((! (s = XCreateRegion()))  || (! (t = XCreateRegion()))) return 0;
+    if (! (s = XCreateRegion())) return 0;
+    if (! (t = XCreateRegion())) { XDestroyRegion(s); return 0; }
     if ((grow = (dx < 0))) dx = -dx;
     if (dx) Compress(r, s, t, (unsigned) 2*dx, TRUE, grow);
     if ((grow = (dy < 0))) dy = -dy;
-- 
1.7.0.4



More information about the xorg-devel mailing list