cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=15b9a640ac0bc14dce0af360e7c888f8674c8dff

commit 15b9a640ac0bc14dce0af360e7c888f8674c8dff
Author: Cedric BAIL <ced...@efl.so>
Date:   Mon Oct 14 13:37:50 2013 +0200

    evas: fix CID 1102547 - Resource leak
    
    If all rectangle are clipped out, it is perfectly possible to return
    no rectangle, this would lead to a possible leak.
---
 src/lib/evas/common/evas_tiler.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/lib/evas/common/evas_tiler.c b/src/lib/evas/common/evas_tiler.c
index b9f982a..9f0fef5 100644
--- a/src/lib/evas/common/evas_tiler.c
+++ b/src/lib/evas/common/evas_tiler.c
@@ -939,14 +939,14 @@ evas_common_tilebuf_get_render_rects(Tilebuf *tb)
           }
         return rects;
      }
-   
+
    rbuf = malloc(sizeof(Tilebuf_Rect) * num);
    if (!rbuf) return NULL;
-   
+
    for (i = 0, n = tb->rects.head; n; n = n->next)
      {
         rect_t cur;
-        
+
         cur = ((rect_node_t *)n)->rect;
         RECTS_CLIP_TO_RECT(cur.left, cur.top, cur.width, cur.height,
                            0, 0, tb->outbuf_w, tb->outbuf_h);
@@ -966,6 +966,10 @@ evas_common_tilebuf_get_render_rects(Tilebuf *tb)
              i++;
           }
      }
+
+   // It is possible that due to the clipping we do not return any rectangle 
here.
+   if (!rects) free(rbuf);
+
    return rects;
 }
 

-- 


Reply via email to