#1576 closed defect (fixed)
Crash during destruction of shapefile datasources without spatial references
Reported by: | Kosta | Owned by: | Mateusz Łoskot |
---|---|---|---|
Priority: | normal | Milestone: | 1.5.0 |
Component: | OGR_SRS | Version: | unspecified |
Severity: | major | Keywords: | |
Cc: | warmerdam |
Description
During the destruction of a OGRShapeLayer object without a valid spatial reference object (poSRS == NULL) a NULL pointer exception is generated when calling "poSRS->Release()".
In OGRFeatureDefn::Release() this case is handled by testing for "this != NULL". The same test should be added to OGRSpatialReference::Release():
Index: ogrspatialreference.cpp =================================================================== --- ogrspatialreference.cpp (revision 11280) +++ ogrspatialreference.cpp (working copy) @@ -290,7 +290,7 @@ void OGRSpatialReference::Release() { - if( Dereference() <= 0 ) + if( this && Dereference() <= 0 ) delete this; }
Change History (8)
comment:1 by , 17 years ago
Priority: | normal → high |
---|
comment:2 by , 17 years ago
Cc: | added |
---|---|
Milestone: | → 1.5.0 |
Owner: | changed from | to
Priority: | high → normal |
comment:3 by , 17 years ago
But then the same behavior should be implemented for OGRFeatureDefn::Release()!
comment:4 by , 17 years ago
Status: | new → assigned |
---|
comment:5 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed in r11294. Both Frank's and Kosta's suggestions have been applied.
Note:
See TracTickets
for help on using tickets.
Mateusz,
I understand you have already re-added the "this" test to the OGRSpatialReference Release method. But it is really an error in calling code to invoke Release on a NULL pointer. So I would like you to:
It is sufficient to do this cleanup in trunk.
Thanks...