Opened 20 years ago

Closed 20 years ago

#720 closed defect (fixed)

Memory leak with initialized class for embedded scalebars

Reported by: warmerdam Owned by: sdlime
Priority: high Milestone:
Component: MapServer C Library Version: 4.3
Severity: normal Keywords:
Cc:

Description

To reproduce:

 cd msautotest/gdal
 shp2img -m rot_out.map -o out.png

Under valgrind this will report (amoung other things):

==2012== 440 bytes in 1 blocks are definitely lost in loss record 16 of 17
==2012==    at 0x400268D5: malloc (vg_replace_malloc.c:160)
==2012==    by 0x8053434: initClass (mapfile.c:1585)
==2012==    by 0x80B5C8F: msEmbedScalebar (mapscale.c:325)
==2012==    by 0x806F8E6: msDrawMap (mapdraw.c:328)
==2012==    by 0x804EABE: main (shp2img.c:159)

This seems to be due to there being no corresponding freeClass() for
the initClass() in msEmbedScalebar().   I don't know this stuff too well,
so I hesitate to try and fix it myself.

Change History (2)

comment:1 by sdlime, 20 years ago

Status: newassigned
I'll take care of this one...

Steve

comment:2 by sdlime, 20 years ago

Resolution: fixed
Status: assignedclosed
I think I found and fixed this one. Turns out the numclasses layer member was
never set so freeLayer never called freeClass. If you've got a test case handy
and could run it that would confirm the fix. I'll check the legend embedding
code too.

Steve
Note: See TracTickets for help on using tickets.