Re: failed test when installing Cairo on windows



*alloc/free is not safe. You should be using New* and Safefree for *alloc/free calls. I remember the same problem being resolved in DBD-Pg a little while back. The attached diff is against 1.044. At first I only changed the calloc/free calls, which were responsible for the test failure on windows. But then I also noticed you had 4 malloc/free calls lying around. Although they were causing no test failures I figured while I was at it I might as well fix those, as well. Feel free to drop those changes if you disagree =)

C:\compile\Cairo-1.044>nmake test

Microsoft (R) Program Maintenance Utility Version 7.10.3077
Copyright (C) Microsoft Corporation.  All rights reserved.

C:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
t/Cairo...........ok
t/CairoFont.......ok
t/CairoMatrix.....ok
t/CairoPath.......ok
t/CairoPattern....ok
t/CairoSurface....ok
All tests successful.
Files=6, Tests=191,  1 wallclock secs ( 0.00 cusr +  0.00 csys =  0.00 CPU)


Torsten Schoenfeld wrote:
On Fri, 2007-12-28 at 16:58 +0000, rahed wrote:

Free to wrong pool 3d2970 not 2080102 at t/Cairo.t line 201.

when running dmake test for Cairo-1.044.

Does anyone know what it means and how to remedy?
Perl is 5.10.0.

We've seen reports of this happening on Windows already, but no-one has
tracked the problem down yet.  I suspect it's a problem in the cairo
library itself, not the bindings.  If you have a debugger handy, maybe
you can try to find the cause of this?


diff Cairo-1.044-old/CairoFont.xs Cairo-1.044/CairoFont.xs
75c75
<       glyphs = calloc (sizeof (cairo_glyph_t), num_glyphs);
---
      Newz(0,glyphs,num_glyphs,cairo_glyph_t);
80c80
<       free (glyphs);
---
      Safefree (glyphs);
diff Cairo-1.044-old/CairoMatrix.xs Cairo-1.044/CairoMatrix.xs
14c14,15
<       cairo_matrix_t *dst = malloc (sizeof (cairo_matrix_t));
---
      cairo_matrix_t *dst;
      New(0,dst,1,cairo_matrix_t);
104c105
<       free (matrix);
---
      Safefree (matrix);
diff Cairo-1.044-old/CairoSurface.xs Cairo-1.044/CairoSurface.xs
145c145
<       callback = calloc (sizeof (CairoPerlCallback), 1);
---
      Newz(0,callback,1,CairoPerlCallback);
164c164
<       free (callback);
---
      Safefree (callback);
diff Cairo-1.044-old/Cairo.xs Cairo-1.044/Cairo.xs
43c43
<       child_isa_full = malloc (strlen (child_package) + 5 + 1);
---
      New(0,child_isa_full,strlen(child_package) + 5 + 1,char);
47c47
<       free (child_isa_full);
---
      Safefree (child_isa_full);
354c354
<               pts = malloc (sizeof (double) * n);
---
              New(0,pts,n,double);
364c364
<               free (pts);
---
              Safefree (pts);
516c516
<       glyphs = calloc (sizeof (cairo_glyph_t), num_glyphs);
---
      Newz(0,glyphs,num_glyphs,cairo_glyph_t);
520c520
<       free (glyphs);
---
      Safefree (glyphs);
554c554
<       glyphs = calloc (sizeof (cairo_glyph_t), num_glyphs);
---
      Newz(0,glyphs,num_glyphs,cairo_glyph_t);
559c559
<       free (glyphs);
---
      Safefree (glyphs);
572c572
<       glyphs = calloc (sizeof (cairo_glyph_t), num_glyphs);
---
      Newz(0,glyphs,num_glyphs,cairo_glyph_t);
576c576
<       free (glyphs);
---
      Safefree (glyphs);
611c611
<               dashes = malloc (sizeof (double) * count);
---
              New(0,dashes,count,double);
620c620
<       free (dashes);
---
      Safefree (dashes);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]