NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/39684: RB_REMOVE trashes link to tree, when requested to remove object that isn't in tree



The following reply was made to PR lib/39684; it has been noted by GNATS.

From: Antti Kantee <pooka%cs.hut.fi@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: lib/39684: RB_REMOVE trashes link to tree, when requested to 
remove object that isn't in tree
Date: Fri, 3 Oct 2008 18:00:21 +0300

 On Fri Oct 03 2008 at 14:10:00 +0000, m-Matti-a.Lehtonen%IKI.Fi@localhost 
wrote:
 > RB_REMOVE trashes root of tree (set to NULL), when requested to remove 
 > object that isn't in tree.
 > 
 > I would expect that "nothing" is done, when removing object that isn't in 
 > tree, instead of losing the whole tree.
 > >How-To-Repeat:
 > Try to remove an object from [populated] tree that isn't actually inserted 
 > there.
 > >Fix:
 > Make sure that object exists (by e.g. RB_INSERT() or RB_FIND() ) in tree, 
 > before remove operation.
 
 IMHO this is a case of "garbage in, garbage out".  You should probably
 add a "ONTREE" flag or somesuch to your local data structure.
 


Home | Main Index | Thread Index | Old Index