Ticket #839 (closed defect: fixed)
memory leak in msAddLabel
|Reported by:||sgillies@…||Owned by:||sdlime|
|Component:||MapServer C Library||Version:||4.3|
Found a small leak in msAddLabel. Exposed when I ran the attached Python script within valgrind using the mapserver/tests/test.map file like: [sean@lenny tests]$ valgrind --tool=memcheck --suppressions=/home/sean/projects/valgrind-python.supp --num-callers=12 --leak-check=yes python testdraw.py ==5304== 5 bytes in 1 blocks are definitely lost in loss record 2 of 75 ==5304== at 0x1B904A80: malloc (vg_replace_malloc.c:131) ==5304== by 0x1B9DA4EF: strdup (in /lib/tls/libc-2.3.3.so) ==5304== by 0x1BF1E6B0: msAddLabel (maplabel.c:90) ==5304== by 0x1BF37792: msDrawShape (mapdraw.c:1246) ==5304== by 0x1BF36646: msDrawVectorLayer (mapdraw.c:774) ==5304== by 0x1BF36244: msDrawLayer (mapdraw.c:627) ==5304== by 0x1BF3598A: msDrawMap (mapdraw.c:322) ==5304== by 0x1BECD27E: mapObj_draw (mapscript_wrap.c:1438) ==5304== by 0x1BEEC354: _wrap_mapObj_draw (mapscript_wrap.c:16905) ==5304== by 0x80EA40C: PyCFunction_Call (in /usr/bin/python) ==5304== by 0x805B3B6: PyObject_Call (in /usr/bin/python) ==5304== by 0x80AB92A: (within /usr/bin/python) ==5304== ==5304== LEAK SUMMARY: ==5304== definitely lost: 5 bytes in 1 blocks. ==5304== possibly lost: 0 bytes in 0 blocks. ==5304== still reachable: 1086179 bytes in 708 blocks. ==5304== suppressed: 200 bytes in 1 blocks. ==5304== Reachable blocks (those to which a pointer was found) are not shown. ==5304== To see them, rerun with: --show-reachable=yes There's only one label being drawn, so this small leak might be worse if there are more labels.
Note: See TracTickets for help on using tickets.