Opened 8 years ago

Closed 8 years ago

#6329 closed defect (fixed)

[PATCH] Fix memleak in OGRILI1Layer::JoinSurfaceLayer()

Reported by: Even Rouault Owned by: pka
Priority: normal Milestone: 2.0.2
Component: default Version: unspecified
Severity: normal Keywords: ili1
Cc:

Description

https://api.travis-ci.org/jobs/104435908/log.txt?deansi=true reports on ogr_ili.py (and confirmed by Valgrind)

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7fd45694fd9a in operator new(unsigned long) (/home/travis/build/rouault/gdal_coverage/install-gcc-5.2.0/lib64/libasan.so.2.0.0+0x97d9a)
    #1 0x7fd446dd91a6 in OGRILI1Layer::JoinSurfaceLayer(OGRILI1Layer*, int) /home/travis/build/rouault/gdal_coverage/gdal/ogr/ogrsf_frmts/ili/ogrili1layer.cpp:533
    #2 0x7fd446dd6b4b in OGRILI1Layer::JoinGeomLayers() /home/travis/build/rouault/gdal_coverage/gdal/ogr/ogrsf_frmts/ili/ogrili1layer.cpp:463
    #3 0x7fd446dcb547 in OGRILI1Layer::GetNextFeature() /home/travis/build/rouault/gdal_coverage/gdal/ogr/ogrsf_frmts/ili/ogrili1layer.cpp:103
    #4 0x7fd446e5e898 in OGR_L_GetNextFeature /home/travis/build/rouault/gdal_coverage/gdal/ogr/ogrsf_frmts/generic/ogrlayer.cpp:550
    #5 0x7fd431dc0458 in OGRLayerShadow_GetNextFeature extensions/ogr_wrap.cpp:3845
    #6 0x7fd431dc0458 in _wrap_Layer_GetNextFeature extensions/ogr_wrap.cpp:8738

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7fd45694fd9a in operator new(unsigned long) (/home/travis/build/rouault/gdal_coverage/install-gcc-5.2.0/lib64/libasan.so.2.0.0+0x97d9a)
    #1 0x7fd447b8a6b0 in OGRCompoundCurve::clone() const /home/travis/build/rouault/gdal_coverage/gdal/ogr/ogrcompoundcurve.cpp:217
    #2 0x7fd446dd9193 in OGRILI1Layer::JoinSurfaceLayer(OGRILI1Layer*, int) /home/travis/build/rouault/gdal_coverage/gdal/ogr/ogrsf_frmts/ili/ogrili1layer.cpp:531
    #3 0x7fd446dd6b4b in OGRILI1Layer::JoinGeomLayers() /home/travis/build/rouault/gdal_coverage/gdal/ogr/ogrsf_frmts/ili/ogrili1layer.cpp:463
    #4 0x7fd446dcb547 in OGRILI1Layer::GetNextFeature() /home/travis/build/rouault/gdal_coverage/gdal/ogr/ogrsf_frmts/ili/ogrili1layer.cpp:103
    #5 0x7fd446e5e898 in OGR_L_GetNextFeature /home/travis/build/rouault/gdal_coverage/gdal/ogr/ogrsf_frmts/generic/ogrlayer.cpp:550
    #6 0x7fd431dc0458 in OGRLayerShadow_GetNextFeature extensions/ogr_wrap.cpp:3845
    #7 0x7fd431dc0458 in _wrap_Layer_GetNextFeature extensions/ogr_wrap.cpp:8738

The proposed patch fixes that, but given the non obvious logic of this method, it should be check by more expert eyes.

Attachments (1)

fix_JoinSurfaceLayer_leak.patch (1.0 KB ) - added by Even Rouault 8 years ago.

Download all attachments as: .zip

Change History (5)

by Even Rouault, 8 years ago

comment:1 by pka, 8 years ago

Looks good to me, thanks! For me it's ok to have the leak in 2.0.2, because the behaviour with same geometry was much worse before (crash or wrong results).

in reply to:  1 comment:2 by Even Rouault, 8 years ago

Replying to pka:

Looks good to me, thanks! For me it's ok to have the leak in 2.0.2, because the behaviour with same geometry was much worse before (crash or wrong results).

ok, I let you apply in trunk and branches/2.0 ? I agree it is probably not critical enough to call for a new 2.0.2 RC

comment:3 by Even Rouault, 8 years ago

Hum, as I finally want to issue another RC for other reasons :

trunk r33155, branches/2.0 r33156 "ILI1: fix memory leak in OGRILI1Layer::JoinSurfaceLayer() (#6329)"

(but I now realize there are other leaks I've fixed in trunk in other parts of the driver)

comment:4 by Even Rouault, 8 years ago

Milestone: 2.0.2
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.