Changes between Initial Version and Version 37 of Ticket #86
- Timestamp:
- Nov 21, 2007, 2:24:38 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #86
- Property Severity Significant → Unassigned
- Property Reporter changed from to
- Property Component Core → Build scripts
- Property Version 3.0.0 → 2.2.3
-
Ticket #86 – Description
initial v37 1 {{{2 1 There is a high possibility that constructor of LineString class will cause memory leaks. 3 2 4 3 Here is small snipped with current version of this ctor: 5 4 5 {{{ 6 6 LineString::LineString(CoordinateSequence* newCoords, const GeometryFactory *factory) 7 7 : Geometry(factory) … … 20 20 } 21 21 22 Now, the small piece of code with how I create LineString object in one of my test. 23 This test tries to create one-point linestring intentionaly. 22 }}} 24 23 24 Now, the small piece of code with how I create LineString object in one of my test. This test tries to create one-point linestring intentionaly. 25 26 {{{ 25 27 void test() 26 28 { … … 48 50 } 49 51 52 }}} 50 53 51 54 Now, the explanation: 52 55 53 56 1. New coordiante sequence is created with only one point 57 54 58 2. New linestringis created with one-point sequence that is expected to be invalid 59 55 60 3. LineString ctor recognizes this sequence as invalid and throws IllegalArgumentException 61 56 62 4. At this moment, the line [1] is not called, so the sequence previously created does not become a part of LineString object and LineString::points member is left as null 63 57 64 5. When exception is thrown in line [3], the LineString destructor is called but 'points' is null, so the sequence is not deallocated (BUM!) 65 58 66 6. Finally, sequnce 'pseq' leaks 67 59 68 7. To avoid the memory leaks, temporary solution is to deallocate it on the client side, when exception is catched, in line [4]. 60 69 … … 68 77 If newCoords is not a null pointer, then the sequence will be assigned to points member and in case of exception, 69 78 LineString destructor will deallocated it properly. 70 }}}