fixed memory initialization bug in remove_font_transforms filter
authorMatthias Kramm <kramm@quiss.org>
Wed, 17 Mar 2010 23:46:59 +0000 (16:46 -0700)
committerMatthias Kramm <kramm@quiss.org>
Wed, 17 Mar 2010 23:46:59 +0000 (16:46 -0700)
lib/filters/remove_font_transforms.c
lib/pdf/InfoOutputDev.cc

index 06e8031..06b6300 100644 (file)
@@ -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;t<orig->num_glyphs;t++) {
        if(orig->glyphs[t].unicode==32)
index 5990d4f..a977970 100644 (file)
@@ -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);