MapServer / MapServer-import

3 stars 2 forks source link

msFreeHashItems() leaks table->items on empty hash tables #2211

Closed tbonfort closed 12 years ago

tbonfort commented 12 years ago

Reporter: dmorissette Date: 2007/08/07 - 21:23 msFreeHashItems() does not attempt to free the table->items memory if numitems == 0. This leads to leaks for empty hash tables initialized with either msCreateHashTable() or initHashTable():

==17790== 164 bytes in 1 blocks are definitely lost in loss record 2 of 6
==17790==    at 0x401C422: malloc (vg_replace_malloc.c:149)
==17790==    by 0x80609C0: msCreateHashTable (maphash.c:52)
==17790==    by 0x80F192D: msInitWmsParamsObj (mapwmslayer.c:50)
==17790==    by 0x808EDFA: msDrawMap (mapdraw.c:307)
==17790==    by 0x805856B: msGenerateImages (maptemplate.c:3400)
==17790==    by 0x8054EE0: main (mapserv.c:1287)
==17790==
==17790==
==17790== 2,624 bytes in 16 blocks are definitely lost in loss record 3 of 6
==17790==    at 0x401C422: malloc (vg_replace_malloc.c:149)
==17790==    by 0x8060A09: initHashTable (maphash.c:65)
==17790==    by 0x806BD5B: initMap (mapfile.c:3892)
==17790==    by 0x806E6E0: msLoadMap (mapfile.c:4492)
==17790==    by 0x805194A: loadMap (mapserv.c:201)
==17790==    by 0x80541C7: main (mapserv.c:1160)
tbonfort commented 12 years ago

Author: sdlime Date: 2007/08/07 - 21:30 Sorry my mistake (and Howard's) I remove that check in 0944ec0913bd1f08785e14d55fd70423d3760d91 (r6489). Can you re-run your test?

Steve

tbonfort commented 12 years ago

Author: dmorissette Date: 2007/08/07 - 21:33 Yup. Leak is gone. Thanks. Marking fixed.

tbonfort commented 12 years ago

Author: sdlime Date: 2007/08/07 - 21:44 Great. I had a brain fart Sunday morning not noticing the initialization of the items array.