View Issue Details

IDProjectCategoryView StatusLast Update
0032189LazarusLazUtilspublic2017-07-23 15:10
ReporterMartin Schneeweis Assigned ToOndrej Pokorny  
Status resolvedResolutionfixed 
Product Version1.9 (SVN) 
Summary0032189: TAvgLvlTree: SegFault in "Clear" and "Destroy", if OwnsObjects=true and the Tree is empty
DescriptionSee "Additional Information" below (laz_avl_tree.pp - procedure TAVLTree.Clear - I guess it should be sufficient to move the line "DisposeNode(ANode")" into the block above (if ANode<>nil...))
Steps To Reproduce<code pascal>
program AvgTreeBug;
  Tree: TAvgLvlTree;
  Tree := TAvgLvlTree.Create;
  Tree.OwnsObjects := True;
</code pascal>

=> SegFault

Alternatively, a "Tree.Free" also produces a SegFault, if the Tree does not contain any objects.

Additional InformationIn laz_avl_tree.pp:

<code pascal>
procedure TAVLTree.Clear;
  procedure DeleteNode(ANode: TAVLTreeNode);
    if ANode<>nil then begin
</code pascal>

I guess it should be sufficient to move the line "DisposeNode(ANode")" into the block above (if ANode<>nil...)

TagsNo tags attached.
Fixed in Revision55561
Attached Files


Juha Manninen

2017-07-23 08:30

developer   ~0101860

Could you please create a proper patch.

Issue History

Date Modified Username Field Change
2017-07-23 06:22 Martin Schneeweis New Issue
2017-07-23 08:30 Juha Manninen Note Added: 0101860
2017-07-23 14:58 Ondrej Pokorny Assigned To => Ondrej Pokorny
2017-07-23 14:58 Ondrej Pokorny Status new => assigned
2017-07-23 15:10 Ondrej Pokorny Fixed in Revision => 55561
2017-07-23 15:10 Ondrej Pokorny LazTarget => -
2017-07-23 15:10 Ondrej Pokorny Status assigned => resolved
2017-07-23 15:10 Ondrej Pokorny Resolution open => fixed