NetBSD-Bugs archive

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

Re: lib/50681: memory leak in tdelete(3) when deleting root node



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

From: Markiyan Kushnir <markiyan.kushnir%gmail.com@localhost>
To: Christos Zoulas <christos%zoulas.com@localhost>
Cc: gnats-bugs%netbsd.org@localhost, lib-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, 
	netbsd-bugs%netbsd.org@localhost
Subject: Re: lib/50681: memory leak in tdelete(3) when deleting root node
Date: Wed, 20 Jan 2016 21:49:47 +0200

 so 1.4 put free() under an "if" condition -- which cased the leak.
 Removing just if(), and calling free() unconditionally would fix the
 problem.  In this case, the tdelete() will return the pointer to the
 node that was just deleted, which should be fine according to POSIX.
 
 --
 Markiyan
 
 2016-01-20 21:44 GMT+02:00 Christos Zoulas <christos%zoulas.com@localhost>:
 > On Jan 20,  7:35pm, markiyan.kushnir%gmail.com@localhost (Markiyan Kushnir) wrote:
 > -- Subject: Re: lib/50681: memory leak in tdelete(3) when deleting root node
 >
 > |  Based on discussion with Pedro F. Giffuni (pfg%freebsd.org@localhost) and
 > |  further with Ed Shouten (ed%freebsd.org@localhost), my suggestion to return NULL
 > |  in that case was not correct.  A recent revision of POSIX prescribes
 > |  to return "unspecified non-null pointer" in this case.  So just a
 > |  reversal of revision 1.4 of tdelete.c was suggested.
 > |
 >
 > But that leaks? Right?
 >
 > christos
 



Home | Main Index | Thread Index | Old Index