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

Submitted by Ander Conselvan de Oliveira on March 30, 2011, 8:12 p.m.

Details

Message ID 1301490729-22084-14-git-send-email-ander.conselvan-de-oliveira@nokia.com
State Deferred, archived
Headers show

Not browsing as part of any series.

Commit Message

Ander Conselvan de Oliveira March 30, 2011, 8:12 p.m.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>
---
 src/Region.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Patch hide | download patch | download mbox

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;