summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gfx/cro.c8
-rw-r--r--kicad/lib-parse.c4
-rw-r--r--kicad/pl-render.c6
-rw-r--r--kicad/sch-render.c4
4 files changed, 19 insertions, 3 deletions
diff --git a/gfx/cro.c b/gfx/cro.c
index bf51cb5..6f9ad6d 100644
--- a/gfx/cro.c
+++ b/gfx/cro.c
@@ -714,10 +714,16 @@ static int cr_png_end(void *ctx)
{
struct cro_ctx *cc = ctx;
int w, h, stride;
+ uint32_t *data;
- cro_img_end(cc, &w, &h, &stride);
+ data = cro_img_end(cc, &w, &h, &stride);
cro_img_write(cc->s, cc->output_name);
+ cairo_surface_destroy(cc->s);
+ cairo_destroy(cc->cr);
+ free(data);
+ free(cc);
+
return 0;
}
diff --git a/kicad/lib-parse.c b/kicad/lib-parse.c
index e24e37a..e2f8a29 100644
--- a/kicad/lib-parse.c
+++ b/kicad/lib-parse.c
@@ -360,6 +360,10 @@ static void free_objs(struct lib_obj *objs)
while (objs) {
next = objs->next;
switch (objs->type) {
+ case lib_obj_poly:
+ free(objs->u.poly.x);
+ free(objs->u.poly.y);
+ break;
case lib_obj_text:
free((char *) objs->u.text.s);
break;
diff --git a/kicad/pl-render.c b/kicad/pl-render.c
index c56519c..ded0373 100644
--- a/kicad/pl-render.c
+++ b/kicad/pl-render.c
@@ -61,9 +61,11 @@ static char *expand(const struct pl_ctx *pl, const char *s,
unsigned size = 0;
unsigned len;
char *x;
+ bool do_free;
unsigned n;
while (1) {
+ do_free = 0;
p = strchr(s, '%');
if (!p)
break;
@@ -88,6 +90,7 @@ static char *expand(const struct pl_ctx *pl, const char *s,
for (sch = sheets; sch; sch = sch->next)
n++;
alloc_printf(&x, "%u", n);
+ do_free = 1;
break;
case 'P':
x = "%P"; // sheet path
@@ -101,6 +104,7 @@ static char *expand(const struct pl_ctx *pl, const char *s,
sch = sch->next)
n++;
alloc_printf(&x, "%u", n);
+ do_free = 1;
break;
case 'T':
x = (char *) sheet->title;
@@ -122,6 +126,8 @@ static char *expand(const struct pl_ctx *pl, const char *s,
s = p + 2;
memcpy(res + size, x, len);
size += len;
+ if (do_free)
+ free(x);
}
len = strlen(s);
diff --git a/kicad/sch-render.c b/kicad/sch-render.c
index 52be40f..27b5ecb 100644
--- a/kicad/sch-render.c
+++ b/kicad/sch-render.c
@@ -111,8 +111,8 @@ static void do_hsheet_text(const struct sch_obj *obj,
text_show(&sheet_txt, gfx, COLOR_HSHEET_SHEET, LAYER_HSHEET_FIELD);
text_show(&file_txt, gfx, COLOR_HSHEET_FILE, LAYER_HSHEET_FIELD);
-// free((void *) ctx->sheet);
-// free((void *) ctx->file);
+ free((void *) sheet_txt.s);
+ free((void *) file_txt.s);
}