[perl-Cairo] Plug a leak in Cairo::Region->create
- From: Torsten Schönfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Cairo] Plug a leak in Cairo::Region->create
- Date: Mon, 2 May 2011 19:49:33 +0000 (UTC)
commit ec3b1632df5a53b3383c978a1220a48d36423f15
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date: Mon May 2 21:49:14 2011 +0200
Plug a leak in Cairo::Region->create
CairoRegion.xs | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/CairoRegion.xs b/CairoRegion.xs
index b8afd96..ee9a8fb 100644
--- a/CairoRegion.xs
+++ b/CairoRegion.xs
@@ -13,24 +13,26 @@ void DESTROY (cairo_region_t * region);
CODE:
cairo_region_destroy (region);
+# cairo_region_t * cairo_region_create (void);
+# cairo_region_t * cairo_region_create_rectangle (const cairo_rectangle_int_t *rect);
# cairo_region_t * cairo_region_create_rectangles (const cairo_rectangle_int_t *rects, int count);
cairo_region_t_noinc *
cairo_region_create (class, ...)
- PREINIT:
- cairo_rectangle_int_t *rects;
- int i, count;
CODE:
if (items == 1) {
RETVAL = cairo_region_create ();
} else if (items == 2) {
RETVAL = cairo_region_create_rectangle (SvCairoRectangleInt (ST (1)));
} else {
+ cairo_rectangle_int_t *rects;
+ int i, count;
count = items - 1;
Newz (0, rects, count, cairo_rectangle_int_t);
for (i = 1; i < items; i++) {
rects[i-1] = *SvCairoRectangleInt (ST (i));
}
RETVAL = cairo_region_create_rectangles (rects, count);
+ Safefree (rects);
}
OUTPUT:
RETVAL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]