Ticket #68 (closed defect: fixed)

Opened 22 months ago

Last modified 22 months ago

microregex memory leak

Reported by: anonymous Owned by: mooneer
Priority: major Milestone:
Component: microregex Version:
Keywords: Cc:

Description

valgrind reports one memory leak in microregex_match(). here's the valgrind output:

#valgrind --leak-check=full ./microregex
...
Match found.
group[0] = ABC
group[1] = ABC
==27105==
==27105== ERROR SUMMARY: 11 errors from 6 contexts (suppressed: 0 from 0)
==27105== malloc/free: in use at exit: 1,498 bytes in 114 blocks.
==27105== malloc/free: 170 allocs, 56 frees, 2,019 bytes allocated.
==27105== For counts of detected errors, rerun with: -v
==27105== searching for pointers to 114 not-freed blocks.
==27105== checked 49,368 bytes.
==27105==
==27105== 1,498 (44 direct, 1,454 indirect) bytes in 1 blocks are definitely lost in loss record 9 of 16
==27105==    at 0x4023799: malloc (vg_replace_malloc.c:207)
==27105==    by 0x80486F8: microregex_state_new (microregex_matcher.c:38)
==27105==    by 0x8049332: microregex_match (microregex_matcher.c:487)
==27105==    by 0x804863B: main (microregex.c:42)
==27105==
==27105== LEAK SUMMARY:
==27105==    definitely lost: 44 bytes in 1 blocks.
==27105==    indirectly lost: 1,454 bytes in 113 blocks.
==27105==      possibly lost: 0 bytes in 0 blocks.
==27105==    still reachable: 0 bytes in 0 blocks.
==27105==         suppressed: 0 bytes in 0 blocks.

Change History

Changed 22 months ago by anonymous

note: tested on svn revision 436.

Changed 22 months ago by anonymous

there are memory leaks in parser too, so i removed your refcounting and added "list of allocated structures". patch attached, you can use it in any way you want, i don't want any credits or so.

p.s. i can't attach patch (seems that you have error in trac settings), so you can download it from the following url: http://www.mediafire.com/?51eifwmh9th

Changed 22 months ago by mooneer

  • status changed from new to closed
  • resolution set to fixed

Applied in r437, merged with Kite trunk in r438, r439.

Note: See TracTickets for help on using tickets.