Opened 5 years ago

Closed 5 years ago

#4218 closed defect (fixed)

Memory leak in lwline_clip_to_ordinate_range

Reported by: Algunenano Owned by: komzpa
Priority: high Milestone: PostGIS 3.0.0
Component: postgis Version: master
Keywords: Cc:

Description

Detected when running unit tests (test_lwmline_clip):

Direct leak of 16 byte(s) in 2 object(s) allocated from:
    #0 0x556b12c5f1d9 in __interceptor_malloc (/home/raul/dev/public/postgis/liblwgeom/cunit/.libs/lt-cu_tester+0xf81d9)
    #1 0x7fa0b14dff89 in lwcollection_construct_empty /home/raul/dev/public/postgis/liblwgeom/lwcollection.c:106:15
    #2 0x7fa0b152b96a in lwline_clip_to_ordinate_range /home/raul/dev/public/postgis/liblwgeom/lwlinearreferencing.c:581:15
    #3 0x7fa0b152b96a in lwgeom_clip_to_ordinate_range /home/raul/dev/public/postgis/liblwgeom/lwlinearreferencing.c:886
    #4 0x7fa0b152b015 in lwcollection_clip_to_ordinate_range /home/raul/dev/public/postgis/liblwgeom/lwlinearreferencing.c:858:10
    #5 0x7fa0b152b015 in lwgeom_clip_to_ordinate_range /home/raul/dev/public/postgis/liblwgeom/lwlinearreferencing.c:904
    #6 0x556b12c9fa3a in test_lwmline_clip /home/raul/dev/public/postgis/liblwgeom/cunit/cu_algorithm.c:774:6
    #7 0x7fa0b11ec117  (/usr/lib/libcunit.so.1+0x4117)

Direct leak of 16 byte(s) in 2 object(s) allocated from:
    #0 0x556b12c5f1d9 in __interceptor_malloc (/home/raul/dev/public/postgis/liblwgeom/cunit/.libs/lt-cu_tester+0xf81d9)
    #1 0x7fa0b14dff89 in lwcollection_construct_empty /home/raul/dev/public/postgis/liblwgeom/lwcollection.c:106:15
    #2 0x7fa0b152b96a in lwline_clip_to_ordinate_range /home/raul/dev/public/postgis/liblwgeom/lwlinearreferencing.c:581:15
    #3 0x7fa0b152b96a in lwgeom_clip_to_ordinate_range /home/raul/dev/public/postgis/liblwgeom/lwlinearreferencing.c:886
    #4 0x7fa0b152b015 in lwcollection_clip_to_ordinate_range /home/raul/dev/public/postgis/liblwgeom/lwlinearreferencing.c:858:10
    #5 0x7fa0b152b015 in lwgeom_clip_to_ordinate_range /home/raul/dev/public/postgis/liblwgeom/lwlinearreferencing.c:904
    #6 0x556b12c9f993 in test_lwmline_clip /home/raul/dev/public/postgis/liblwgeom/cunit/cu_algorithm.c:758:6
    #7 0x7fa0b11ec117  (/usr/lib/libcunit.so.1+0x4117)

Change History (5)

comment:1 by komzpa, 5 years ago

Algunenano, can we make it available on the CI? Now that we're building our own environment completely for Travis we probably could. Then there won't be chance to commit such leaks.

comment:2 by dbaston, 5 years ago

I think we'd need to first figure out how to ignore leaks we can't do anything about (GEOS' default GeometryFactory instance, for example). Or, we could perhaps enable the output but not fail on detection of a leak.

comment:3 by komzpa, 5 years ago

created #4219 for that.

comment:4 by komzpa, 5 years ago

Owner: changed from pramsey to komzpa

comment:5 by komzpa, 5 years ago

Resolution: fixed
Status: newclosed

In 16961:

Tidy lwline_clip_to_ordinate_range

Fix memory leak.

Closes #4218
Closes https://github.com/postgis/postgis/pull/324

Note: See TracTickets for help on using tickets.