Changes between Version 37 and Version 38 of Ticket #86


Ignore:
Timestamp:
Nov 21, 2007, 2:26:18 PM (16 years ago)
Author:
mloskot
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #86 – Description

    v37 v38  
    1717
    1818   // 'points' WILL LEAK WHEN EXCEPTION ABOVE IS THROWN
    19    points=newCoords; // <--- [1]
     19   points=newCoords; // <--- 1
    2020}
    2121
     
    60603. LineString ctor recognizes this sequence as invalid and throws IllegalArgumentException
    6161
    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
     624. 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
    6363
    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!)
     645. When exception is thrown in line 3, the LineString destructor is called but 'points' is null, so the sequence is not deallocated (BUM!)
    6565
    66666. Finally, sequnce 'pseq' leaks
    6767
    68 7. To avoid the memory leaks, temporary solution is to deallocate it on the client side, when exception is catched, in line [4].
     687. To avoid the memory leaks, temporary solution is to deallocate it on the client side, when exception is catched, in line 4.
    6969
    7070The main problem is that LineString ctor does not promises (prepares LineString object well) that all resources LineString is responsible for will be deallocated by dctor in case of problems.
    7171
    72 The simplest possible solution is to move line [1]:
    73 points=newCoords; // <--- [1]
     72The simplest possible solution is to move line 1:
     73points=newCoords; // <--- 1
    7474
    7575to the beginning of the LineString::LineString().