From 5244627ce001a4b2c49595fe38042628856be1d3 Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Wed, 17 Mar 2010 16:46:59 -0700 Subject: [PATCH] fixed memory initialization bug in remove_font_transforms filter --- lib/filters/remove_font_transforms.c | 2 +- lib/pdf/InfoOutputDev.cc | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/filters/remove_font_transforms.c b/lib/filters/remove_font_transforms.c index 06e8031..06b6300 100644 --- a/lib/filters/remove_font_transforms.c +++ b/lib/filters/remove_font_transforms.c @@ -137,7 +137,7 @@ static transformedfont_t* transformedfont_new(gfxfont_t*orig, mymatrix_t*m) transformedfont_t*f = rfx_calloc(sizeof(transformedfont_t)); f->orig = orig; f->matrix = *m; - f->used = malloc(sizeof(f->used[0])*orig->num_glyphs); + f->used = rfx_calloc(sizeof(f->used[0])*orig->num_glyphs); int t; for(t=0;tnum_glyphs;t++) { if(orig->glyphs[t].unicode==32) diff --git a/lib/pdf/InfoOutputDev.cc b/lib/pdf/InfoOutputDev.cc index 5990d4f..a977970 100644 --- a/lib/pdf/InfoOutputDev.cc +++ b/lib/pdf/InfoOutputDev.cc @@ -148,8 +148,7 @@ static int addSpace(gfxfont_t*font) static gfxfont_t* createGfxFont(FontInfo*src) { - gfxfont_t*font = (gfxfont_t*)malloc(sizeof(gfxfont_t)); - memset(font, 0, sizeof(gfxfont_t)); + gfxfont_t*font = (gfxfont_t*)rfx_calloc(sizeof(gfxfont_t)); font->glyphs = (gfxglyph_t*)malloc(sizeof(gfxglyph_t)*src->num_glyphs); memset(font->glyphs, 0, sizeof(gfxglyph_t)*src->num_glyphs); -- 1.7.10.4