diff options
author | Cedric BAIL <cedric@efl.so> | 2013-10-14 13:37:50 +0200 |
---|---|---|
committer | Cedric BAIL <cedric@efl.so> | 2013-10-14 13:37:50 +0200 |
commit | 15b9a640ac0bc14dce0af360e7c888f8674c8dff (patch) | |
tree | a3b08321414bedd92422cdee247d16a6770771f9 /src/lib/evas/common | |
parent | 1c1b48ca64c4d13cfd3677cde1ee99e4cf6c2c15 (diff) |
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.
Diffstat (limited to 'src/lib/evas/common')
-rw-r--r-- | src/lib/evas/common/evas_tiler.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/evas/common/evas_tiler.c b/src/lib/evas/common/evas_tiler.c index b9f982a10d..9f0fef58af 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) | |||
939 | } | 939 | } |
940 | return rects; | 940 | return rects; |
941 | } | 941 | } |
942 | 942 | ||
943 | rbuf = malloc(sizeof(Tilebuf_Rect) * num); | 943 | rbuf = malloc(sizeof(Tilebuf_Rect) * num); |
944 | if (!rbuf) return NULL; | 944 | if (!rbuf) return NULL; |
945 | 945 | ||
946 | for (i = 0, n = tb->rects.head; n; n = n->next) | 946 | for (i = 0, n = tb->rects.head; n; n = n->next) |
947 | { | 947 | { |
948 | rect_t cur; | 948 | rect_t cur; |
949 | 949 | ||
950 | cur = ((rect_node_t *)n)->rect; | 950 | cur = ((rect_node_t *)n)->rect; |
951 | RECTS_CLIP_TO_RECT(cur.left, cur.top, cur.width, cur.height, | 951 | RECTS_CLIP_TO_RECT(cur.left, cur.top, cur.width, cur.height, |
952 | 0, 0, tb->outbuf_w, tb->outbuf_h); | 952 | 0, 0, tb->outbuf_w, tb->outbuf_h); |
@@ -966,6 +966,10 @@ evas_common_tilebuf_get_render_rects(Tilebuf *tb) | |||
966 | i++; | 966 | i++; |
967 | } | 967 | } |
968 | } | 968 | } |
969 | |||
970 | // It is possible that due to the clipping we do not return any rectangle here. | ||
971 | if (!rects) free(rbuf); | ||
972 | |||
969 | return rects; | 973 | return rects; |
970 | } | 974 | } |
971 | 975 | ||